mirror of https://github.com/hashicorp/consul
fix call order in middleware
parent
957301e092
commit
55c0ece134
|
@ -352,12 +352,13 @@ func withRemoteAddrHandler(next http.Handler) http.Handler {
|
||||||
func ensureContentTypeHeader(next http.Handler, logger hclog.Logger) http.Handler {
|
func ensureContentTypeHeader(next http.Handler, logger hclog.Logger) http.Handler {
|
||||||
|
|
||||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||||
|
next.ServeHTTP(resp, req)
|
||||||
|
|
||||||
val := resp.Header().Get(contentTypeHeader)
|
val := resp.Header().Get(contentTypeHeader)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
resp.Header().Set(contentTypeHeader, plainContentType)
|
resp.Header().Set(contentTypeHeader, plainContentType)
|
||||||
logger.Debug("warning: content-type header not explicitly set.", "request-path", req.URL)
|
logger.Debug("warning: content-type header not explicitly set.", "request-path", req.URL)
|
||||||
}
|
}
|
||||||
next.ServeHTTP(resp, req)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue