Learn R Programming

cookiemonster (version 0.1.0)

req_cookiemonster_set: Set cookies from the cookiejar to a httr2 request

Description

Adds all cookies for the domain from the jar to a httr2 request.

Usage

req_cookiemonster_set(req, jar = default_jar(), ...)

Value

A request object (with cookies).

Arguments

req

A request object.

jar

A character string of the path to the cookie jar (the default is to use default_jar() to get a suitable directory).

...

not currently used.

Examples

Run this code
if (FALSE) { # rlang::is_installed(c("httr2", "webfakes"))
library(httr2)
domain <- url_parse(example_url())$hostname
add_cookies(cookiestring = "snicker=doodle; password=secret", domain = domain)
request(example_url()) |>
  req_url_path("/cookies/set") |>
  req_cookiemonster_set() |>
  req_perform() |>
  resp_body_json()
}

Run the code above in your browser using DataLab