Skip to content

Add default apollo engine headers#857

Closed
js wants to merge 1 commit intoapollographql:masterfrom
js:apollo-egine-headers
Closed

Add default apollo engine headers#857
js wants to merge 1 commit intoapollographql:masterfrom
js:apollo-egine-headers

Conversation

@js
Copy link
Copy Markdown
Contributor

@js js commented Oct 23, 2019

If you're using Apollo Engine, there's an option to identify clients and their versions.

To be perfectly frank I'm not quite sure how such an API should actually look in the iOS SDK, since the URLSession is passed in and there's really no existing API (?) for mutating the request outside of that. So not quite sure where this belongs, if at all, or how the API should look. So here's a getter with the headers and some default values that users can merge into their url session or whatever.

is this even worth doing? 🤷‍♂ 😄

@designatednerd
Copy link
Copy Markdown
Contributor

Ha I was actually planning on doing something similar today. You can use the pre-flight delegate's willSend method on the HTTPNetworkTransport to alter headers yourself.

However I'd like to make these variables so that people can pass in their own values here - this could be helpful for people who want to specifically identify a beta client or A/B test variant or whatever else in a way that can't really be identified through the bundle identifier alone.

Would you mind if I took a stab at it on my end?

@js
Copy link
Copy Markdown
Contributor Author

js commented Oct 23, 2019

Yeah saw the delegate, but since I need it on all GQL request anyway I just set it on the session config.

Feel free to stab away at it if you got a plan, I certainly don’t :)

@designatednerd
Copy link
Copy Markdown
Contributor

🔪away shortly!

bundleValue(forKey: String(kCFBundleVersionKey)) ?? ""
return [
"apollographql-client-name": identifier,
"apollographql-client-version": version,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this suppose to be apollo-ios and 0.18.0 or com.example.app and <app-version>?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably be com.example.app and <app-version> to distinguish between different apps hitting the same graph - that's what I went with in #858

@designatednerd
Copy link
Copy Markdown
Contributor

@js my 🔪at this went down a tiiiiiny bit of a 🐇🕳️, but it's up as #858.

@js
Copy link
Copy Markdown
Contributor Author

js commented Oct 24, 2019

Closing in favour of #858

@js js closed this Oct 24, 2019
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.

3 participants