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

Method handleModalResult

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

Source from the content-addressed store, hash-verified

361}
362
363func (h *httpHandlers) handleModalResult(w http.ResponseWriter, r *http.Request) {
364 defer func() {
365 panicErr := util.PanicHandler("handleModalResult", recover())
366 if panicErr != nil {
367 http.Error(w, fmt.Sprintf("internal server error: %v", panicErr), http.StatusInternalServerError)
368 }
369 }()
370
371 setNoCacheHeaders(w)
372
373 if r.Method != http.MethodPost {
374 http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
375 return
376 }
377
378 body, err := io.ReadAll(r.Body)
379 if err != nil {
380 http.Error(w, fmt.Sprintf("failed to read request body: %v", err), http.StatusBadRequest)
381 return
382 }
383
384 var result rpctypes.ModalResult
385 if err := json.Unmarshal(body, &result); err != nil {
386 http.Error(w, fmt.Sprintf("failed to parse JSON: %v", err), http.StatusBadRequest)
387 return
388 }
389
390 h.Client.CloseModal(result.ModalId, result.Confirm)
391
392 w.Header().Set("Content-Type", "application/json")
393 w.WriteHeader(http.StatusOK)
394 json.NewEncoder(w).Encode(map[string]any{"success": true})
395}
396
397func (h *httpHandlers) handleTermInput(w http.ResponseWriter, r *http.Request) {
398 defer func() {

Callers

nothing calls this directly

Calls 8

PanicHandlerFunction · 0.92
setNoCacheHeadersFunction · 0.85
CloseModalMethod · 0.80
ErrorMethod · 0.45
ReadAllMethod · 0.45
SetMethod · 0.45
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected