(w http.ResponseWriter, r *http.Request)
| 80 | } |
| 81 | |
| 82 | func (a *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 83 | if r.URL.Path == a.masterqueryURLPath { |
| 84 | a.handleMasterQuery(w, r) |
| 85 | return |
| 86 | } |
| 87 | if a.configURLPath != "" && r.URL.Path == a.configURLPath { |
| 88 | if a.auth.AllowedAccess(r)&auth.OpGet == auth.OpGet { |
| 89 | camhttputil.ReturnJSON(w, a.appConfig) |
| 90 | } else { |
| 91 | auth.SendUnauthorized(w, r) |
| 92 | } |
| 93 | return |
| 94 | } |
| 95 | trimmedPath := strings.TrimPrefix(r.URL.Path, a.prefix) |
| 96 | if strings.HasPrefix(trimmedPath, "/search") { |
| 97 | a.handleSearch(w, r) |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | if a.proxy == nil { |
| 102 | http.Error(w, "no proxy for the app", 500) |
| 103 | return |
| 104 | } |
| 105 | a.proxy.ServeHTTP(w, r) |
| 106 | } |
| 107 | |
| 108 | // handleMasterQuery allows an app to register the master query that defines the |
| 109 | // domain limiting all subsequent search queries. |
nothing calls this directly
no test coverage detected