(w http.ResponseWriter, r *http.Request)
| 2074 | ` |
| 2075 | |
| 2076 | func handler(w http.ResponseWriter, r *http.Request) { |
| 2077 | path := r.URL.Path |
| 2078 | page, ok := map[string]string{ |
| 2079 | "/": homePage, |
| 2080 | "/other": otherPage, |
| 2081 | "/search": searchPage, |
| 2082 | "/log": logPage, |
| 2083 | "/frame": framePage, |
| 2084 | "/title": titleChangePage, |
| 2085 | "/alert": alertPage, |
| 2086 | }[path] |
| 2087 | if !ok { |
| 2088 | http.NotFound(w, r) |
| 2089 | return |
| 2090 | } |
| 2091 | |
| 2092 | if path == "/search" { |
| 2093 | r.ParseForm() |
| 2094 | page = fmt.Sprintf(page, r.Form["q"][0], r.Form["s"][0]) |
| 2095 | } |
| 2096 | // Some cookies for the tests |
| 2097 | for i := 0; i < 3; i++ { |
| 2098 | http.SetCookie(w, &http.Cookie{ |
| 2099 | Name: fmt.Sprintf("cookie-%d", i), |
| 2100 | Value: fmt.Sprintf("value-%d", i), |
| 2101 | }) |
| 2102 | } |
| 2103 | fmt.Fprintf(w, page) |
| 2104 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…