Commit d91ade02 authored by Volker Dobler's avatar Volker Dobler Committed by Russ Cox

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
parent 71d83b72
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment