EncodeResponse encodes the given structure into an http response.
(w http.ResponseWriter, res interface{}, err bool)
| 20 | |
| 21 | // EncodeResponse encodes the given structure into an http response. |
| 22 | func 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 |
| 31 | func StreamResponse(w http.ResponseWriter, data io.ReadCloser) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…