• Brad Fitzpatrick's avatar
    net/http: clean up the Client redirect code, document Body.Close rules more · aecfcd82
    Brad Fitzpatrick authored
    Issue #8633 (and #9134) noted that we didn't document the rules about
    closing the Response.Body when Client.Do returned both a non-nil
    *Response and a non-nil error (which can only happen when the user's
    CheckRedirect returns an error).
    
    In the process of investigating, I cleaned this code up a bunch, but
    no user-visible behavior should have changed, except perhaps some
    better error messages in some cases.
    
    It turns out it's always been the case that when a CheckRedirect error
    occurs, the Response.Body is already closed. Document that.
    
    And the new code makes that more obvious too.
    
    Fixes #8633
    
    Change-Id: Ibc40cc786ad7fc4e0cf470d66bb559c3b931684d
    Reviewed-on: https://go-review.googlesource.com/21364
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    aecfcd82
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...