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

Function EncodeResponse

sdk/encoder.go:22–28  ·  view source on GitHub ↗

EncodeResponse encodes the given structure into an http response.

(w http.ResponseWriter, res interface{}, err bool)

Source from the content-addressed store, hash-verified

20
21// EncodeResponse encodes the given structure into an http response.
22func EncodeResponse(w http.ResponseWriter, res interface{}, err bool) {
23 w.Header().Set("Content-Type", DefaultContentTypeV1_1)
24 if err {
25 w.WriteHeader(http.StatusInternalServerError)
26 }
27 json.NewEncoder(w).Encode(res)
28}
29
30// StreamResponse streams a response object to the client
31func StreamResponse(w http.ResponseWriter, data io.ReadCloser) {

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…