Skip to content

Commit

Permalink
api: add "Content-Type" and "Server" headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jzelinskie committed Feb 24, 2016
1 parent 2d8d9ca commit f351d63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/v1/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func decodeJSON(r *http.Request, v interface{}) error {
return json.NewDecoder(io.LimitReader(r.Body, maxBodySize)).Decode(v)
}

func writeResponse(w io.Writer, resp interface{}) {
func writeResponse(w http.ResponseWriter, resp interface{}) {
header := w.Header()
header.Set("Content-Type", "application/json;charset=utf-8")
header.Set("Server", "clair")
err := json.NewEncoder(w).Encode(resp)
if err != nil {
panic("v1: failed to marshal response: " + err.Error())
Expand Down

0 comments on commit f351d63

Please sign in to comment.