api: add "Content-Type" and "Server" headers

This commit is contained in:
Jimmy Zelinskie 2016-02-04 14:18:33 -05:00
parent 2d8d9ca401
commit f351d6304e

View File

@ -37,7 +37,10 @@ func decodeJSON(r *http.Request, v interface{}) error {
return json.NewDecoder(io.LimitReader(r.Body, maxBodySize)).Decode(v) 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) err := json.NewEncoder(w).Encode(resp)
if err != nil { if err != nil {
panic("v1: failed to marshal response: " + err.Error()) panic("v1: failed to marshal response: " + err.Error())