Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intercepting headers in middlewares #1271

Merged
merged 2 commits into from May 28, 2022
Merged

Commits on Mar 4, 2019

  1. Fix intercepting headers in middlewares

    As explained in the TestInterceptedHeader test, in case a middleware
    filters out the headers, this middleware can be done inefficient in case
    one following handler is using c.String or other methods writing to the
    response body directly.
    
    This commit fixes the issue by using c.Writer when writing the Status as
    done in other c.Header, c.SetCookie and other response writers.
    
    The bug has been originally discovered using
    https://github.com/gin-contrib/gzip where a failing test has been added
    here: https://github.com/tjamet/gzip/blob/header/gzip_test.go#L71
    
    Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>
    tjamet committed Mar 4, 2019
    Copy the full SHA
    b8db138 View commit details
    Browse the repository at this point in the history
  2. Skip Intercepted Header test for go <1.6

    Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>
    tjamet committed Mar 4, 2019
    Copy the full SHA
    520df29 View commit details
    Browse the repository at this point in the history