Quellcode durchsuchen

Improve the help page a bit

Lu Stadler vor 7 Jahren
Ursprung
Commit
efadb657d9
1 geänderte Dateien mit 9 neuen und 6 gelöschten Zeilen
  1. 9 6
      go/fake-http/fake-http.go

+ 9 - 6
go/fake-http/fake-http.go

@ -118,11 +118,14 @@ func main() {
118 118
	})
119 119
120 120
	http.HandleFunc("/_help", func(w http.ResponseWriter, req *http.Request) {
121
		urls := []string{
122
			"/_log",
123
			"/_stub",
124
			"/_stubs",
125
			"/_help",
121
		urls := []struct {
122
			URL     string
123
			Summary string
124
		}{
125
			{URL: "/_log", Summary: "View all received requests with responses"},
126
			{URL: "/_stub", Summary: "Add a new response stub"},
127
			{URL: "/_stubs", Summary: "View all defined stubs"},
128
			{URL: "/_help", Summary: "This help"},
126 129
		}
127 130
		fmt.Fprint(w, `<!doctype html>
128 131
<html>
@ -132,7 +135,7 @@ func main() {
132 135
	<body>
133 136
		<ul>`)
134 137
		for _, url := range urls {
135
			fmt.Fprintf(w, "<li><pre><a href=\"%s\">%s</a></pre></li>", url, url)
138
			fmt.Fprintf(w, "<li><pre><a href=\"%s\">%s</a> - %s</pre></li>", url.URL, url.URL, url.Summary)
136 139
		}
137 140
		fmt.Fprint(w, `
138 141
		</ul>