-
Notifications
You must be signed in to change notification settings - Fork 69
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
add an api-version
header to all requests
#856
base: main
Are you sure you want to change the base?
Conversation
@@ -452,6 +452,14 @@ impl Generator { | |||
let dur = std::time::Duration::from_secs(15); | |||
|
|||
reqwest::ClientBuilder::new() | |||
.default_headers( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't cover the new_with_client()
case, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. Good point! And 1. new_with_client()
is actually the case that matter and 2. we can't modify a reqwest::Client
nor can we convert it into a builder.
@davepacheco I think I need to change this progenitor interface more significantly--once we have a // 1
Client::new_with_builder(reqwest::Client::builder().custom_settings());
// 2
Client::new_map(|builder| builder.customsettings()); Are there others? I think I prefer 2 in that it (I think) makes it clear to the user that the |
Yeah I was afraid of that. Elsewhere I've had stuff like this accept a In your option 2, it's possible to allow either one's settings to override the other's. I'm not sure if that's better or worse. I don't have a strong feeling but I think (1) would be more composable? Looking at where my example is used, there's: Another example is in the Omicron TLS certificate tests, where I have this helper that keeps track of a few things needed to create a working client: I think you could do all of this with your (2) but it would mean passing closures around through a few layers instead of |
Closes #564.