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

feature: Adds support for GraphQL over HTTP media type #558

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

calvincestari
Copy link
Member

@calvincestari calvincestari commented Dec 16, 2024

Closes apollographql/apollo-ios#3485.

  1. Make sure we include the new type in the 'accept' request header.
  2. Update tests for new content type.
  3. There were no changes needed for error handling because we do not throw when the response status code falls outside the 200..<300 range.
  4. Our non-multipart response parser does not require that the content type actually be application/json. Instead it simply attempts to deserialize anything as if it is JSON. It's only in the multipart parsers that we do a content type check for the chunks. @AnthonyMDev - this hasn't been an issue for now but do you think we should add this check? I'm inclined to leave the standard parser as it is.

@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Dec 16, 2024

✅ Docs Preview Ready

No new or changed pages found.

Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for apollo-ios-docc canceled.

Name Link
🔨 Latest commit 179d004
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docc/deploys/677f22139fc98d00085a191a

Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for eclectic-pie-88a2ba ready!

Name Link
🔨 Latest commit 179d004
🔍 Latest deploy log https://app.netlify.com/sites/eclectic-pie-88a2ba/deploys/677f22133735200008e410c4
😎 Deploy Preview https://deploy-preview-558--eclectic-pie-88a2ba.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@calvincestari
Copy link
Member Author

calvincestari commented Dec 16, 2024

I'm going to add a couple tests of our request chain to ensure that the assumption we make on content type holds true.

Done.


// This test is odd because you might assume it would fail but there is no content-type checking on standard
// GraphQL response parsing. So this test is here to ensure that existing behaviour does not change.
func test__response__givenUnknownContentType_shouldNotFail() throws {
Copy link
Member Author

Choose a reason for hiding this comment

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

I've added tests to keep the existing behaviour of standard GraphQL response parsing including this odd one.

Copy link
Contributor

@AnthonyMDev AnthonyMDev left a comment

Choose a reason for hiding this comment

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

Tests all look good. I just thing that we should clean the repeated string constants up with a helper method.

@calvincestari calvincestari marked this pull request as draft December 21, 2024 04:10
@calvincestari calvincestari force-pushed the feature/graphql-media-type branch from 78085ef to 179d004 Compare January 9, 2025 01:10
@calvincestari calvincestari marked this pull request as ready for review January 9, 2025 01:11
@calvincestari
Copy link
Member Author

@AnthonyMDev - this PR is ready for another review, I've addressed the previous comment.

@calvincestari calvincestari merged commit 1844748 into main Jan 9, 2025
34 checks passed
@calvincestari calvincestari deleted the feature/graphql-media-type branch January 9, 2025 17:54
BobaFetters pushed a commit to apollographql/apollo-ios that referenced this pull request Jan 9, 2025
BobaFetters pushed a commit that referenced this pull request Jan 9, 2025
ee597100 feature: Adds support for GraphQL over HTTP media type (#558)

git-subtree-dir: apollo-ios
git-subtree-split: ee59710005066e0f9516730a64eb800d8486a74a
BobaFetters pushed a commit that referenced this pull request Jan 9, 2025
…HTTP media type

git-subtree-dir: apollo-ios
git-subtree-mainline: b7ef8e6
git-subtree-split: ee59710005066e0f9516730a64eb800d8486a74a
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.

feature: Implement GraphQL response type
3 participants