mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: close Body in client code always, even on errors, and document
Fixes #6981 LGTM=rsc R=golang-codereviews, nightlyone CC=adg, dsymonds, golang-codereviews, rsc https://golang.org/cl/85560045
This commit is contained in:
parent
0d441a088d
commit
a8d90ec350
4 changed files with 70 additions and 3 deletions
|
|
@ -867,3 +867,9 @@ func (r *Request) wantsHttp10KeepAlive() bool {
|
|||
func (r *Request) wantsClose() bool {
|
||||
return hasToken(r.Header.get("Connection"), "close")
|
||||
}
|
||||
|
||||
func (r *Request) closeBody() {
|
||||
if r.Body != nil {
|
||||
r.Body.Close()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue