Get returns all cookies stored for a given URI. If there are no cookies for the provided host, the returned slice will be nil. The CookieJar keeps its own copies of cookies, so it is safe to release the returned cookies after use.
(uri *fasthttp.URI)
| 69 | // The CookieJar keeps its own copies of cookies, so it is safe to release the returned |
| 70 | // cookies after use. |
| 71 | func (cj *CookieJar) Get(uri *fasthttp.URI) []*fasthttp.Cookie { |
| 72 | if uri == nil { |
| 73 | return nil |
| 74 | } |
| 75 | |
| 76 | secure := bytes.Equal(uri.Scheme(), httpsScheme) |
| 77 | return cj.getByHostAndPath(uri.Host(), uri.Path(), secure) |
| 78 | } |
| 79 | |
| 80 | // getByHostAndPath returns cookies stored for a specific host and path. |
| 81 | func (cj *CookieJar) getByHostAndPath(host, path []byte, secure bool) []*fasthttp.Cookie { |