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

RequestHeaders should be retrieved from the currentRequest #34

Merged
merged 1 commit into from
Feb 27, 2019

Conversation

swhitty
Copy link
Contributor

@swhitty swhitty commented Feb 26, 2019

As outlined within #33, URLSession automatically adds additional HTTP Headers to requests that are not observed by bagel.

Currently BagelRequestCarrier.m extracts allHTTPHeaderFields from the original request that is enqueued and not the current request that is transmitted over the network.

It can be assumed this is to avoid logging anything after receiving an HTTP 301/2/3 redirect response, but a redirect will not cause any of the allHTTPHeaderFields to change so it is safe and preferred to log the headers from the currentRequest.

To be completely transparent about redirects, Bagel could swizzle @selector(_redirectRequest:redirectResponse:completion:); and log etc...

URLSession provides a mechanism for additional HTTP Header fields to be added to each URLRequest that manages via `URLSessionConfiguration.HTTPAdditionalHeaders`

request headers should be retrieved from the currentRequest of the data task to observer these and other headers that iOS automatically sends.
@yagiz yagiz merged commit 7f21e32 into yagiz:master Feb 27, 2019
ncnk pushed a commit to ncnk/Bagel that referenced this pull request Jul 12, 2021
RequestHeaders should be retrieved from the `currentRequest`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants