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

Method contextForRequest

internal/http/query.go:60–67  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

58}
59
60func (api *API) contextForRequest(r *http.Request) (context.Context, func()) {
61 ctx := context.TODO() // TODO(dennwc): get from request
62 cancel := func() {}
63 if api.config.Timeout > 0 {
64 ctx, cancel = context.WithTimeout(ctx, api.config.Timeout)
65 }
66 return ctx, cancel
67}
68
69func defaultErrorFunc(w query.ResponseWriter, err error) {
70 data, _ := json.Marshal(err.Error())

Callers 2

ServeV1QueryMethod · 0.95
ServeV1ShapeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected