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

JSONRequest losing headers when useGETForQueries is true #1419

Closed
dchohfi opened this issue Sep 29, 2020 · 1 comment · Fixed by #1420
Closed

JSONRequest losing headers when useGETForQueries is true #1419

dchohfi opened this issue Sep 29, 2020 · 1 comment · Fixed by #1420
Labels
bug Generally incorrect behavior networking-stack
Milestone

Comments

@dchohfi
Copy link
Contributor

dchohfi commented Sep 29, 2020

Bug report

After migrating my project to the new version, I'm not able to use a service that has authentication via header.

Versions

Please fill in the versions you're currently using:

  • apollo-ios SDK version: 0.34.0
  • Xcode version: 12.0.1
  • Swift version: 5.3

Steps to reproduce

Create an interceptor that adds a header to the request, the NetworkTransporter must have useGETForQueries=true.

Further details

When the method toURLRequest gets called, the request gets recreated and all headers are lost, including the defaults added by apollo. After digging into the code, I found that the library is instantiating a new URLRequest instead of just changing the URL.

https://github.com/apollographql/apollo-ios/blob/main/Sources/Apollo/JSONRequest.swift#L101

@dchohfi
Copy link
Contributor Author

dchohfi commented Sep 29, 2020

I would love to send a PR to fix it, just want to confirm first if this is what is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior networking-stack
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants