-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httr2 equivalent of httr::set_config ? #435
Comments
There's nothing equivalent, but maybe there should be, just for proxies. |
Thanks for confirming! I'll stick with httr for this purpose for now. |
How would you see this being implemented here? I would love to help if possible. |
I don't know yet; I need to think about it. |
Hello, I am glad this issue already exists. I would like to second the motion to add something similar to And in addition to that: Thank you so, so much for all your amazing work here, Hadley! |
Out of interest, what sort of options are you looking to set? |
In order to configure my proxy settings I need the following:
It works totally fine used in |
Thanks! Definitely something I plan to add when I'm next working on httr2. |
Would also be useful if you want to set up caching. |
Since Maybe something like this? host_config("google.org", \(req) req |> req_set_header("foo"))
host_config("*", \(req) req |> req_proxy_something()) Would then need some kind of host matching algorithm but maybe it's possible to hack something together with regexps that's good enough? hostname_to_regex <- function(x) {
x <- gsub(".", "\\\\.", x, fixed = TRUE)
x <- gsub("*", ".*", x, fixed = TRUE)
x <- paste0("^", x, "$")
x
} |
https://httr2.r-lib.org/reference/index.html
Is there an equivalent way to set global configurations that will be used by all requests?
I'm specifically looking for a way for an R user to set a proxy configuration that would apply to all requests made in an R session.
The text was updated successfully, but these errors were encountered: