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

Method dumpCookiesToReq

client/cookiejar.go:273–281  ·  view source on GitHub ↗

dumpCookiesToReq writes the stored cookies to the given request.

(req *fasthttp.Request)

Source from the content-addressed store, hash-verified

271
272// dumpCookiesToReq writes the stored cookies to the given request.
273func (cj *CookieJar) dumpCookiesToReq(req *fasthttp.Request) {
274 uri := req.URI()
275 secure := bytes.Equal(uri.Scheme(), httpsScheme)
276 cookies := cj.getByHostAndPath(uri.Host(), uri.Path(), secure)
277 for _, cookie := range cookies {
278 req.Header.SetCookieBytesKV(cookie.Key(), cookie.Value())
279 fasthttp.ReleaseCookie(cookie)
280 }
281}
282
283// parseCookiesFromResp parses the cookies from the response and stores them for the specified host and path.
284func (cj *CookieJar) parseCookiesFromResp(host, _ []byte, resp *fasthttp.Response) {

Callers 1

parserRequestHeaderFunction · 0.80

Calls 6

getByHostAndPathMethod · 0.95
URIMethod · 0.80
SchemeMethod · 0.65
HostMethod · 0.65
PathMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected