EncodeResponse encodes an response value. If the response is not a StatusCoder, the http.StatusInternalServerError will be used.
(response interface{})
| 57 | // EncodeResponse encodes an response value. |
| 58 | // If the response is not a StatusCoder, the http.StatusInternalServerError will be used. |
| 59 | func (s *ResponseEncoder) EncodeResponse(response interface{}) { |
| 60 | encode(s.w, response, http.StatusOK) |
| 61 | } |
| 62 | |
| 63 | func encode(w http.ResponseWriter, any interface{}, code int) { |
| 64 | const contentType = "application/json; charset=utf-8" |