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

Method handleTermInput

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

Source from the content-addressed store, hash-verified

395}
396
397func (h *httpHandlers) handleTermInput(w http.ResponseWriter, r *http.Request) {
398 defer func() {
399 panicErr := util.PanicHandler("handleTermInput", recover())
400 if panicErr != nil {
401 http.Error(w, fmt.Sprintf("internal server error: %v", panicErr), http.StatusInternalServerError)
402 }
403 }()
404
405 setNoCacheHeaders(w)
406
407 if r.Method != http.MethodPost {
408 http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
409 return
410 }
411
412 body, err := io.ReadAll(r.Body)
413 if err != nil {
414 http.Error(w, fmt.Sprintf("failed to read request body: %v", err), http.StatusBadRequest)
415 return
416 }
417
418 var event vdom.VDomEvent
419 if err := json.Unmarshal(body, &event); err != nil {
420 http.Error(w, fmt.Sprintf("failed to parse JSON: %v", err), http.StatusBadRequest)
421 return
422 }
423 if strings.TrimSpace(event.WaveId) == "" {
424 http.Error(w, "waveid is required", http.StatusBadRequest)
425 return
426 }
427 if event.TermInput == nil {
428 http.Error(w, "terminput is required", http.StatusBadRequest)
429 return
430 }
431
432 h.renderLock.Lock()
433 h.Client.Root.Event(event, h.Client.GlobalEventHandler)
434 h.renderLock.Unlock()
435
436 w.WriteHeader(http.StatusNoContent)
437}
438
439func (h *httpHandlers) handleDynContent(w http.ResponseWriter, r *http.Request) {
440 defer func() {

Callers

nothing calls this directly

Calls 6

PanicHandlerFunction · 0.92
setNoCacheHeadersFunction · 0.85
ErrorMethod · 0.45
ReadAllMethod · 0.45
EventMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected