Merge branch v2.1 into master
This commit is contained in:
commit
60e247862a
77 changed files with 1128 additions and 514 deletions
|
@ -172,6 +172,21 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) (
|
|||
}
|
||||
}
|
||||
|
||||
// ContentType
|
||||
if config.ContentType != nil {
|
||||
if middleware != nil {
|
||||
return nil, badConf
|
||||
}
|
||||
middleware = func(next http.Handler) (http.Handler, error) {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
if !config.ContentType.AutoDetect {
|
||||
rw.Header()["Content-Type"] = nil
|
||||
}
|
||||
next.ServeHTTP(rw, req)
|
||||
}), nil
|
||||
}
|
||||
}
|
||||
|
||||
// CustomErrors
|
||||
if config.Errors != nil {
|
||||
if middleware != nil {
|
||||
|
|
|
@ -467,6 +467,7 @@ func createHTTPServer(ctx context.Context, ln net.Listener, configuration *stati
|
|||
configuration.ForwardedHeaders.Insecure,
|
||||
configuration.ForwardedHeaders.TrustedIPs,
|
||||
httpSwitcher)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ type blackholeResponseWriter struct{}
|
|||
func (b blackholeResponseWriter) Flush() {}
|
||||
|
||||
func (b blackholeResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
return nil, nil, errors.New("you can hijack connection on blackholeResponseWriter")
|
||||
return nil, nil, errors.New("connection on blackholeResponseWriter cannot be hijacked")
|
||||
}
|
||||
|
||||
func (b blackholeResponseWriter) Header() http.Header {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue