-1

Edit:

Example from the documentation:

r <- GET("http://httpbin.org/cookies", set_cookies(a = 1, b = 2))

I would expect that the Cookies to be i the request headers:

r$request$headers
                                            Accept 
"application/json, text/xml, application/xml, */*"

Long Version:

I do a get request in R:

library(httr)
library(magrittr)
url <- "https://www.r-bloggers.com"
r <- url %>% GET 

And collect the cookies being used:

ck <- cookies(r)$value
names(ck) <- cookies(r)$name

Next i set the cookies:

#url <- "https://www.r-bloggers.com" same page or
url <- "https://www.r-bloggers.com/econometrics-postdoc-and-computational-statistics-postdoc-openings-here-in-the-stan-group-at-columbia/"
req <- url %>% GET(set_cookies(.cookies = ck))

and then i would expect that i sent the cookies with the headers.

req$request$headers

I would expect the cookies being in the request header, because of this: How are cookies passed in the HTTP protocol?. And i assume these are my request headers req$request$headers.

Tlatwork
  • 1,445
  • 12
  • 35

1 Answers1

0

An answer was posted on Github: https://github.com/r-lib/httr/issues/629#issuecomment-557802675.

Cookies are sent, just not seen in the request$headers variable:

r <- GET("https://httpbin.org/cookies", set_cookies(a = 1, b = 2))
content(r)

Edit:

Answer from jennybc on GitHub:

with_verbose(GET(url = "https://www.r-bloggers.com", set_cookies(.cookies = c(a = "1"))))
Tlatwork
  • 1,445
  • 12
  • 35