Skip to content
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

Open
cole-brokamp opened this issue Feb 5, 2024 · 9 comments
Open

httr2 equivalent of httr::set_config ? #435

cole-brokamp opened this issue Feb 5, 2024 · 9 comments
Labels
feature a feature request or enhancement

Comments

@cole-brokamp
Copy link

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.

@hadley
Copy link
Member

hadley commented Feb 5, 2024

There's nothing equivalent, but maybe there should be, just for proxies.

@cole-brokamp
Copy link
Author

Thanks for confirming! I'll stick with httr for this purpose for now.

@hadley hadley reopened this Feb 5, 2024
@cole-brokamp
Copy link
Author

How would you see this being implemented here? I would love to help if possible.

@hadley
Copy link
Member

hadley commented Feb 5, 2024

I don't know yet; I need to think about it.

@hadley hadley added the feature a feature request or enhancement label Feb 27, 2024
@yannikbuhl
Copy link

Hello, I am glad this issue already exists. I would like to second the motion to add something similar to httr::set_config. I use it a lot in scripts where I work with API wrappers based on httr. However, now I am set to work with a R package API wrapper based on httr2 which at the moment does not provide support to add options to the underlying HTTP request through its API, making it necessary to have some way to globally set the configuration.

And in addition to that: Thank you so, so much for all your amazing work here, Hadley!

@hadley
Copy link
Member

hadley commented Aug 6, 2024

Out of interest, what sort of options are you looking to set?

@yannikbuhl
Copy link

In order to configure my proxy settings I need the following:

  • Proxy URL
  • Username / password
  • Authentication method (e.g., NTLM)

It works totally fine used in req_options or req_proxy, however using the package (restatis in my case) I cannot pass these on to the httr2 pipeline used in a non-exported function (we might add support for that later but it would be great if there was a way to globally set the above settings).

@hadley
Copy link
Member

hadley commented Aug 7, 2024

Thanks! Definitely something I plan to add when I'm next working on httr2.

@hadley
Copy link
Member

hadley commented Aug 19, 2024

Would also be useful if you want to set up caching.

Adafede added a commit to taxonomicallyinformedannotation/tima that referenced this issue Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants