diff --git a/api/v1/routes.go b/api/v1/routes.go index b9601e78..59be2b7d 100644 --- a/api/v1/routes.go +++ b/api/v1/routes.go @@ -67,7 +67,10 @@ func writeResponse(w http.ResponseWriter, r *http.Request, status int, resp inte // Gzip the response if the client supports it. var writer io.Writer = w if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { - writer = gzip.NewWriter(w) + gzipWriter := gzip.NewWriter(w) + defer gzipWriter.Close() + writer = gzipWriter + header.Set("Content-Encoding", "gzip") }