mirror of
https://github.com/golang/go
synced 2024-11-13 18:20:32 -07:00
net/http: set cookies in client jar on POST requests.
Cookies recieved in a response to a POST request are stored in the client's jar like they are for GET requests. R=golang-dev, rsc CC=bradfitz, golang-dev https://golang.org/cl/5576065
This commit is contained in:
parent
71d83b72ef
commit
d91ade02e7
@ -274,7 +274,11 @@ func (c *Client) Post(url string, bodyType string, body io.Reader) (r *Response,
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("Content-Type", bodyType)
|
||||
return send(req, c.Transport)
|
||||
r, err = send(req, c.Transport)
|
||||
if c.Jar != nil {
|
||||
c.Jar.SetCookies(req.URL, r.Cookies())
|
||||
}
|
||||
return r, err
|
||||
}
|
||||
|
||||
// PostForm issues a POST to the specified URL,
|
||||
|
Loading…
Reference in New Issue
Block a user