(w http.ResponseWriter, r *http.Request)
| 250 | } |
| 251 | |
| 252 | func (h *httpHandlers) handleConfig(w http.ResponseWriter, r *http.Request) { |
| 253 | defer func() { |
| 254 | panicErr := util.PanicHandler("handleConfig", recover()) |
| 255 | if panicErr != nil { |
| 256 | http.Error(w, fmt.Sprintf("internal server error: %v", panicErr), http.StatusInternalServerError) |
| 257 | } |
| 258 | }() |
| 259 | |
| 260 | setCORSHeaders(w, r) |
| 261 | setNoCacheHeaders(w) |
| 262 | |
| 263 | if r.Method == http.MethodOptions { |
| 264 | w.WriteHeader(http.StatusOK) |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | switch r.Method { |
| 269 | case http.MethodGet: |
| 270 | h.handleConfigGet(w, r) |
| 271 | case http.MethodPost: |
| 272 | h.handleConfigPost(w, r) |
| 273 | default: |
| 274 | http.Error(w, "method not allowed", http.StatusMethodNotAllowed) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | func (h *httpHandlers) handleConfigGet(w http.ResponseWriter, _ *http.Request) { |
| 279 | result := h.Client.Root.GetConfigMap() |
nothing calls this directly
no test coverage detected