MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / handleSchemas

Method handleSchemas

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

Source from the content-addressed store, hash-verified

325}
326
327func (h *httpHandlers) handleSchemas(w http.ResponseWriter, r *http.Request) {
328 defer func() {
329 panicErr := util.PanicHandler("handleSchemas", recover())
330 if panicErr != nil {
331 http.Error(w, fmt.Sprintf("internal server error: %v", panicErr), http.StatusInternalServerError)
332 }
333 }()
334
335 setCORSHeaders(w, r)
336 setNoCacheHeaders(w)
337
338 if r.Method == http.MethodOptions {
339 w.WriteHeader(http.StatusOK)
340 return
341 }
342
343 if r.Method != http.MethodGet {
344 http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
345 return
346 }
347
348 configSchema := GenerateConfigSchema(h.Client.Root)
349 dataSchema := GenerateDataSchema(h.Client.Root)
350
351 result := map[string]any{
352 "config": configSchema,
353 "data": dataSchema,
354 }
355
356 w.Header().Set("Content-Type", "application/json")
357 if err := json.NewEncoder(w).Encode(result); err != nil {
358 log.Printf("failed to encode schemas response: %v", err)
359 http.Error(w, "failed to encode response", http.StatusInternalServerError)
360 }
361}
362
363func (h *httpHandlers) handleModalResult(w http.ResponseWriter, r *http.Request) {
364 defer func() {

Callers

nothing calls this directly

Calls 9

PanicHandlerFunction · 0.92
setCORSHeadersFunction · 0.85
setNoCacheHeadersFunction · 0.85
GenerateConfigSchemaFunction · 0.85
GenerateDataSchemaFunction · 0.85
ErrorMethod · 0.45
WriteHeaderMethod · 0.45
SetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected