MCPcopy Index your code
hub / github.com/0xUnixIO/pulse / handleNodeStatus

Method handleNodeStatus

internal/serverapi/api.go:411–429  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, nodeID string)

Source from the content-addressed store, hash-verified

409}
410
411func (a *API) handleNodeStatus(w http.ResponseWriter, r *http.Request, nodeID string) {
412 if r.Method != http.MethodGet {
413 writeMethodNotAllowed(w, http.MethodGet)
414 return
415 }
416 client, err := a.clientFor(nodeID)
417 if err != nil {
418 writeNodeError(w, err)
419 return
420 }
421 ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
422 defer cancel()
423 out, err := client.Status(ctx)
424 if err != nil {
425 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
426 return
427 }
428 writeJSON(w, http.StatusOK, out)
429}
430
431func (a *API) handleNodeConfig(w http.ResponseWriter, r *http.Request, nodeID string) {
432 if r.Method != http.MethodGet {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 6

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
writeNodeErrorFunction · 0.85
writeJSONFunction · 0.70
StatusMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected