Set cookies.

set_cookies(..., .cookies = character(0))

Arguments

...

a named cookie values

.cookies

a named character vector

See also

cookies() to see cookies in response.

Other config: add_headers, authenticate, config, timeout, use_proxy, user_agent, verbose

Examples

set_cookies(a = 1, b = 2)
#> <request> #> Options: #> * cookie: a=1;b=2
set_cookies(.cookies = c(a = "1", b = "2"))
#> <request> #> Options: #> * cookie: a=1;b=2
GET("http://httpbin.org/cookies")
#> Response [http://httpbin.org/cookies] #> Date: 2018-12-17 20:45 #> Status: 200 #> Content-Type: application/json #> Size: 51 B #> { #> "cookies": { #> "a": "1", #> "b": "2" #> } #> }
GET("http://httpbin.org/cookies", set_cookies(a = 1, b = 2))
#> Response [http://httpbin.org/cookies] #> Date: 2018-12-17 20:45 #> Status: 200 #> Content-Type: application/json #> Size: 51 B #> { #> "cookies": { #> "a": "1", #> "b": "2" #> } #> }