From f351d6304e91d5eced2161efdaddf57b662e7395 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Thu, 4 Feb 2016 14:18:33 -0500 Subject: [PATCH] api: add "Content-Type" and "Server" headers --- api/v1/routes.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/v1/routes.go b/api/v1/routes.go index 89f5e55a..4c881ead 100644 --- a/api/v1/routes.go +++ b/api/v1/routes.go @@ -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())