Skip to content

possibly add a function to modify curl handle options #160

@fangzhou-xie

Description

@fangzhou-xie

First of all, thanks for this package!

I wonder if it is possible to have a function to control curl handle options? I noticed that req_perform function will eventually set the handle options using the req$options but there are only several items can be modified by the existing functions (useragent, proxy, etc). If, for example, I want to set the maxage_conn option, I have to do:

req <- request("https://example.com") %>% 
  req_proxy("127.0.0.1", 1234) %>% 
  req_user_agent("something here")
req$options$maxage_conn <- 10

I was thinking if it is better to have a similar httr2-style function, say req_curl_options = function(.req, ...), to directly modify the content of the request options? Thus, the request can be chained in the usual way:

req <- request("https://example.com") %>% 
  req_proxy("127.0.0.1", 1234) %>% 
  req_user_agent("something here") %>% 
  req_curl_options(maxage_conn = 10) # not implemented, just concept

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions