From: Volker Dobler Date: Sun, 29 Jan 2012 19:16:11 +0000 (-0500) Subject: net/http: set cookies in client jar on POST requests. X-Git-Tag: weekly.2012-02-07~234 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d91ade02e7c0272fe144bedb92601ed00271d372;p=gostls13.git 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 --- diff --git a/src/pkg/net/http/client.go b/src/pkg/net/http/client.go index c9f0240175..09afd5ef1d 100644 --- a/src/pkg/net/http/client.go +++ b/src/pkg/net/http/client.go @@ -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,