MCPcopy
hub / github.com/wavetermdev/waveterm / handleConfig

Method handleConfig

tsunami/engine/serverhandlers.go:252–276  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

250}
251
252func (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
278func (h *httpHandlers) handleConfigGet(w http.ResponseWriter, _ *http.Request) {
279 result := h.Client.Root.GetConfigMap()

Callers

nothing calls this directly

Calls 7

handleConfigGetMethod · 0.95
handleConfigPostMethod · 0.95
PanicHandlerFunction · 0.92
setCORSHeadersFunction · 0.85
setNoCacheHeadersFunction · 0.85
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected