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

Function DecodeRequest

sdk/encoder.go:14–19  ·  view source on GitHub ↗

DecodeRequest decodes an http request into a given structure.

(w http.ResponseWriter, r *http.Request, req interface{})

Source from the content-addressed store, hash-verified

12
13// DecodeRequest decodes an http request into a given structure.
14func DecodeRequest(w http.ResponseWriter, r *http.Request, req interface{}) (err error) {
15 if err = json.NewDecoder(r.Body).Decode(req); err != nil {
16 http.Error(w, err.Error(), http.StatusBadRequest)
17 }
18 return
19}
20
21// EncodeResponse encodes the given structure into an http response.
22func EncodeResponse(w http.ResponseWriter, res interface{}, err bool) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…