(w http.ResponseWriter, r *http.Request)
| 13 | } |
| 14 | |
| 15 | func (h *ManualPathsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 16 | // we need this for testing. |
| 17 | // under normal circumstances this is never nil |
| 18 | if registry.Default == nil { |
| 19 | return |
| 20 | } |
| 21 | |
| 22 | switch r.Method { |
| 23 | case "GET": |
| 24 | paths, err := registry.Default.ManualPaths() |
| 25 | if err != nil { |
| 26 | log.Print("[ERROR] ", err) |
| 27 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 28 | return |
| 29 | } |
| 30 | for i, p := range paths { |
| 31 | paths[i] = strings.TrimPrefix(p, h.Prefix) |
| 32 | } |
| 33 | writeJSON(w, r, paths) |
| 34 | return |
| 35 | |
| 36 | default: |
| 37 | http.Error(w, "not allowed", http.StatusMethodNotAllowed) |
| 38 | } |
| 39 | } |
nothing calls this directly
no test coverage detected