Documentation
¶
Index ¶
Constants ¶
View Source
const X_FORWARDED_HOST_HEADER_KEY = "X-Forwarded-Host"
Variables ¶
View Source
var GzipCompressableTypes = []string{
"text/",
"application/json",
"application/xhtml+xml",
"application/xml",
"image/svg+xml",
"application/javascript",
"application/font-woff",
}
Functions ¶
func NewGzipHandler ¶
Transparently gzip the response body if the client supports it (via the Accept-Encoding header) and the response Content-type starts with one of GzipCompressableTypes.
In difference to the most implementations found in the web, we do the decision of compression in the Writer, when the Content-Type is determined.
Types ¶
type ForwardedHostHandler ¶
func NewForwardedHostHandler ¶
func NewForwardedHostHandler(next http.Handler) *ForwardedHostHandler
func (*ForwardedHostHandler) ServeHTTP ¶
func (p *ForwardedHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GzipResponseWriter ¶
type GzipResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewGzipResponseWriter ¶
func NewGzipResponseWriter(w http.ResponseWriter) *GzipResponseWriter
func (*GzipResponseWriter) Close ¶
func (grw *GzipResponseWriter) Close()
func (*GzipResponseWriter) WriteHeader ¶
func (grw *GzipResponseWriter) WriteHeader(code int)
Click to show internal directories.
Click to hide internal directories.