MCPcopy Create free account
hub / github.com/docker/go-plugins-helpers / handle

Method handle

authorization/api.go:128–143  ·  view source on GitHub ↗
(name string, actionCall actionHandler)

Source from the content-addressed store, hash-verified

126type actionHandler func(Request) Response
127
128func (h *Handler) handle(name string, actionCall actionHandler) {
129 h.HandleFunc(name, func(w http.ResponseWriter, r *http.Request) {
130 var (
131 req Request
132 d = json.NewDecoder(r.Body)
133 )
134 d.UseNumber()
135 if err := d.Decode(&req); err != nil {
136 http.Error(w, err.Error(), http.StatusBadRequest)
137 }
138
139 res := actionCall(req)
140
141 sdk.EncodeResponse(w, res, res.Err != "")
142 })
143}

Callers 1

initMuxMethod · 0.95

Calls 1

HandleFuncMethod · 0.95

Tested by

no test coverage detected