Skip to content

Commit

Permalink
api: close gzip writer to flush it
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M authored and jzelinskie committed Feb 24, 2016
1 parent c2605e0 commit 0e9a7e1
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 @@ -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")
}

Expand Down

0 comments on commit 0e9a7e1

Please sign in to comment.