diff --git a/headers_inspection_handler.go b/headers_inspection_handler.go index 34ddb19..d02033e 100644 --- a/headers_inspection_handler.go +++ b/headers_inspection_handler.go @@ -104,6 +104,9 @@ func (middleware HeadersInspectionHandler) Intercept(pipeline Pipeline, middlewa } } response, err := pipeline.Next(req, middlewareIndex) + if err != nil { + return response, err + } if reqOption.GetInspectResponseHeaders() { for k, v := range response.Header { if len(v) == 1 { @@ -113,8 +116,5 @@ func (middleware HeadersInspectionHandler) Intercept(pipeline Pipeline, middlewa } } } - if err != nil { - return response, err - } return response, err }