diff --git a/src/pkg/net/http/client.go b/src/pkg/net/http/client.go index 09afd5ef1d0..43161da6847 100644 --- a/src/pkg/net/http/client.go +++ b/src/pkg/net/http/client.go @@ -275,7 +275,7 @@ func (c *Client) Post(url string, bodyType string, body io.Reader) (r *Response, } req.Header.Set("Content-Type", bodyType) r, err = send(req, c.Transport) - if c.Jar != nil { + if err == nil && c.Jar != nil { c.Jar.SetCookies(req.URL, r.Cookies()) } return r, err