parserResponseCookie parses the Set-Cookie headers from the response and stores them.
(c *Client, resp *Response, req *Request)
| 327 | |
| 328 | // parserResponseCookie parses the Set-Cookie headers from the response and stores them. |
| 329 | func parserResponseCookie(c *Client, resp *Response, req *Request) error { |
| 330 | var err error |
| 331 | for key, value := range resp.RawResponse.Header.Cookies() { |
| 332 | cookie := fasthttp.AcquireCookie() |
| 333 | if err = cookie.ParseBytes(value); err != nil { |
| 334 | fasthttp.ReleaseCookie(cookie) |
| 335 | break |
| 336 | } |
| 337 | cookie.SetKeyBytes(key) |
| 338 | resp.cookie = append(resp.cookie, cookie) |
| 339 | } |
| 340 | |
| 341 | if err != nil { |
| 342 | return err |
| 343 | } |
| 344 | |
| 345 | // Store cookies in the cookie jar if available. |
| 346 | if c.cookieJar != nil { |
| 347 | c.cookieJar.parseCookiesFromResp(req.RawRequest.URI().Host(), req.RawRequest.URI().Path(), resp.RawResponse) |
| 348 | } |
| 349 | |
| 350 | return nil |
| 351 | } |
| 352 | |
| 353 | // logger is a response hook that logs request and response data if debug mode is enabled. |
| 354 | func logger(c *Client, resp *Response, req *Request) error { |
nothing calls this directly
no test coverage detected
searching dependent graphs…