diff --git a/bind.go b/bind.go index 8b1692508..c6a1ec9e2 100644 --- a/bind.go +++ b/bind.go @@ -23,7 +23,7 @@ type ( // BindUnmarshaler is the interface used to wrap the UnmarshalParam method. BindUnmarshaler interface { // UnmarshalParam decodes and assigns a value from an form or query param. - UnmarshalParam(src string) error + UnmarshalParam(param string) error } ) diff --git a/middleware/compress.go b/middleware/compress.go index ab76203db..2b2750961 100644 --- a/middleware/compress.go +++ b/middleware/compress.go @@ -90,13 +90,17 @@ func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc { } } +func (w *gzipResponseWriter) WriteHeader(code int) { + if code != http.StatusNoContent { // Issue #489 + w.ResponseWriter.Header().Set(echo.HeaderContentEncoding, gzipScheme) + } + w.ResponseWriter.WriteHeader(code) +} + func (w *gzipResponseWriter) Write(b []byte) (int, error) { if w.Header().Get(echo.HeaderContentType) == "" { w.Header().Set(echo.HeaderContentType, http.DetectContentType(b)) } - if w.Header().Get(echo.HeaderContentEncoding) == "" { - w.Header().Set(echo.HeaderContentEncoding, gzipScheme) - } return w.Writer.Write(b) } diff --git a/website/layouts/index.html b/website/layouts/index.html index 328454dac..f24ae5f5d 100644 --- a/website/layouts/index.html +++ b/website/layouts/index.html @@ -12,7 +12,7 @@
- +
diff --git a/website/layouts/partials/head.html b/website/layouts/partials/head.html index 13ee57e41..0e690ed02 100644 --- a/website/layouts/partials/head.html +++ b/website/layouts/partials/head.html @@ -5,16 +5,18 @@ - + + - + + + - - +