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

Have content type of application/vnd.api+json parsed as json in the RestDataSource library #5724

Closed
nholik opened this issue Sep 18, 2021 · 2 comments

Comments

@nholik
Copy link
Contributor

nholik commented Sep 18, 2021

It would be nice if responses using jsonapi where the content type is application/vnd.api+json would be parsed as JSON.

Right now anything with content type starting with 'application/json' or 'application/hal+json' as seen here:

(contentType.startsWith('application/json') ||

and here
contentType.startsWith('application/hal+json'))

is parsed in the library, and it would be nice to have application/vnd.api+json follow the same pattern.

Either adding this additional type or making a more general change to anything ending with '+json' seem like to viable approaches.

I do see here that one suggestion is overriding, but a more general approach may help avoid the question all together with checking for trailing '+json' and having the override option for more esoteric content types outside the two patterns.

I'd be happy to submit a PR if such a change could be accommodated.

@glasser
Copy link
Member

glasser commented Sep 22, 2021

Sure, file a PR. apollo-datasource-rest is not currently very actively maintained but a very simple PR should be fine.

@nholik
Copy link
Contributor Author

nholik commented Sep 22, 2021

Thanks @glasser submitted the change - pretty simple.

glasser added a commit that referenced this issue Sep 29, 2021
…n in rest data source (#5737)

Co-authored-by: David Glasser <glasser@davidglasser.net>
@nholik nholik closed this as completed Sep 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants