(body interface{})
| 160 | } |
| 161 | |
| 162 | func JSONResponse(body interface{}) Responder { |
| 163 | return func(req *http.Request) (*http.Response, error) { |
| 164 | b, _ := json.Marshal(body) |
| 165 | header := http.Header{ |
| 166 | "Content-Type": []string{"application/json"}, |
| 167 | } |
| 168 | return httpResponseWithHeader(200, req, bytes.NewBuffer(b), header), nil |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | // StatusJSONResponse turns the given argument into a JSON response. |
| 173 | // |