mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http/client.go: fix cookie handling on (*Client) Do()
Fix the problem with no cookie handling when sending other than GET or HEAD request through (*Client) Do(*Request) (*Resposne, error). https://code.google.com/p/go/issues/detail?id=3985 Adds a function (*Client) send(*Request) (*Reponse, error): - sets cookies from CookieJar to request, - sends request - parses a reply cookies and updates CookieJar Fixes #3985 R=bradfitz CC=gobot, golang-dev https://golang.org/cl/6653049
This commit is contained in:
parent
8010a430a2
commit
4918e3a960
3 changed files with 33 additions and 38 deletions
|
|
@ -285,6 +285,10 @@ func TestClientSendsCookieFromJar(t *testing.T) {
|
|||
req, _ := NewRequest("GET", us, nil)
|
||||
client.Do(req) // Note: doesn't hit network
|
||||
matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
|
||||
|
||||
req, _ = NewRequest("POST", us, nil)
|
||||
client.Do(req) // Note: doesn't hit network
|
||||
matchReturnedCookies(t, expectedCookies, tr.req.Cookies())
|
||||
}
|
||||
|
||||
// Just enough correctness for our redirect tests. Uses the URL.Host as the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue