MCPcopy
hub / github.com/cayleygraph/cayley / jsonResponse

Function jsonResponse

internal/http/http.go:61–68  ·  view source on GitHub ↗
(w http.ResponseWriter, code int, err interface{})

Source from the content-addressed store, hash-verified

59}
60
61func jsonResponse(w http.ResponseWriter, code int, err interface{}) {
62 w.Header().Set("Content-Type", "application/json")
63 w.WriteHeader(code)
64 w.Write([]byte(`{"error": `))
65 data, _ := json.Marshal(fmt.Sprint(err))
66 w.Write(data)
67 w.Write([]byte(`}`))
68}
69
70type API struct {
71 config *Config

Callers 6

ServeV1QueryMethod · 0.70
ServeV1ShapeMethod · 0.70
RWOnlyMethod · 0.70
ServeV1WriteMethod · 0.70
ServeV1WriteNQuadMethod · 0.70
ServeV1DeleteMethod · 0.70

Calls 4

WriteHeaderMethod · 0.65
WriteMethod · 0.65
SetMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected