MCPcopy
hub / github.com/gofiber/fiber / parserResponseCookie

Function parserResponseCookie

client/hooks.go:329–351  ·  view source on GitHub ↗

parserResponseCookie parses the Set-Cookie headers from the response and stores them.

(c *Client, resp *Response, req *Request)

Source from the content-addressed store, hash-verified

327
328// parserResponseCookie parses the Set-Cookie headers from the response and stores them.
329func 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.
354func logger(c *Client, resp *Response, req *Request) error {

Callers

nothing calls this directly

Calls 5

parseCookiesFromRespMethod · 0.80
URIMethod · 0.80
CookiesMethod · 0.65
HostMethod · 0.65
PathMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…