reqwest.cookie_store
reqwest.cookie_store
Function
Enables or disables cookie storage for the current requesting client. When enabled, the Set-Cookie written by the server during the redirection process will continue to be carried in subsequent jump requests.
Syntax
reqwest(url).cookie_store(enabled)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| enabled | Bool | No | true | Whether to enable cookie storage. |
Return value
| Type | Description |
|---|---|
| Reqwest | Returns the current request builder clone. |
Example
request = reqwest('https://example.com').cookie_store(true) result = type(request) // Output: Reqwest print result
Notes
- After cookie storage is enabled, the Set-Cookie received during the redirection process will only continue to be carried in this send() and its redirection link.
-
cookie_store(true)requests will not enter the shared HTTP client pool to avoid sharing cookie status between different requests.