-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expose the default headers used by clients #2773
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
base: master
Are you sure you want to change the base?
Conversation
f3e4fd2
to
a3cf7f0
Compare
@seanmonstar One failure with the MSRV check, it looks related to the 0.1.16 update of hyper-util. Paths forward:
Any preference? Want me to address it in this PR or a separate one? |
Thanks for the PR! I'm curious, you mentioned for debugging and inspecting. Is there a significant benefit to having programmatic access vs just including them in the |
Yeah, my comment was maybe a bit misleading. It's really for the testing part that it comes in handy. In particular if you want to integrate with vcr cassettes. You can't put in them all the headers which will be used in practice if you can't know the ones in the client. |
a3cf7f0
to
435dbb9
Compare
Looks like it can be merged now. @seanmonstar once this is merged, any idea on when there will be a release containing this patch? I'm unsure about the release cycle used for this project. |
591a486
to
ffa5cd1
Compare
@seanmonstar Since I noticed other PRs getting in, I've rebased this one to keep it ready. Do you have any concerns left with it? |
Hm, I feel like I don't quite understand. Can you say more? My hesitation is around taking caution when exposing references, since those expose internal details (you can't factor away to something else, since you can't produce a reference only within a function). |
Sure, let me expand. I'm having integration tests which serialize requests sent in the VCS cassette format (using vcr_cassette). This is done by taking the built Now some of the headers are supposed to be used by all the requests, so it would make sense to move then in the default headers of the client. In my test, I can get access to the client and the request, but the request doesn't carry the default headers of the client. So my tests become "blind" to any header moved from requests to client. That's why I'd like my tests to be able to get access to the client's headers to have a complete view again. An alternative would be for the
Note that I went with references because that's what |
ffa5cd1
to
28f24bb
Compare
@seanmonstar Did my previous comment help make things clearer? If not feel free to ask questions and I'll expand. |
This is convenient in debug and testing scenario for code using reqwest. In particular for introspecting to know what will be sent without introducing a MITM.
28f24bb
to
5a3d53f
Compare
@seanmonstar Looks like I missed the boat for the latest release. Any chance to attract your attention again and see what to do with this patch? Thanks in advance. |
This is convenient in debug and testing scenario for code using reqwest. In particular for introspecting to know what will be sent without introducing a MITM.