nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

Fixed double WriteHeader calls caused by #71 #73

Closed jameshartig closed 6 years ago

jameshartig commented 6 years ago

@jprobinson Small change that somehow I missed in #71. Apparently in specific scenarios WriteHeader can be called twice which doesn't actually break anything but causes http: multiple response.WriteHeader calls logs. Setting the code to 0 after we call WriteHeader prevents Close from triggering the WriteHeader. I added a test as well to verify.