-
Notifications
You must be signed in to change notification settings - Fork 26
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
Connector: close response bodies #20
Conversation
cb55397
to
0ff7bc5
Compare
Nice catch, thanks! I think this fix is insufficient, though, since it doesn't catch error cases. The idomatic way is to put |
I'd wager that defer is really not necessary for Edit 1defer func() {
err = res.Body.Close()
}()
data, err = ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}
return
Update: fixed in 843d591 |
There. Now we won't overwrite non-nil errors in the defer call, I'm gonna try to pry my ADHD eyes away from this though for the moment. pre-squash branch for any desired cherry picking here |
Connector: adjust response body closure Connector: be consistent about returns Connector: continue consistency efforts, fix positioning of defer call Connector(lint): get rid of useless error check Connector: again, be consistent Connector: Prevent suppressing non-nil errors --- Signed-off-by: kayos@tcp.direct <kayos@tcp.direct>
have been using a vendorized copy of this module with all of these changes in this PR through dev -> qa -> and now prod for the past 5 months or so btw |
Sorry I missed this. Thanks a lot for the contribution. |
HTTP response bodies must be closed.