Skip to content

Detect "errors" in response with "errors" and "data" #446

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

Closed
monikasoni opened this issue May 16, 2018 · 3 comments
Closed

Detect "errors" in response with "errors" and "data" #446

monikasoni opened this issue May 16, 2018 · 3 comments

Comments

@monikasoni
Copy link

I am working on handling GraphQL error response in http proxy. In GraphQL responses "errors" is followed by "data" section.

If "errors" was first field followed by "data", it would be easier for http proxies to parse initial few bytes of response and detect errors. With current spec, json processor will have to continue parsing "data" then search for "errors", which is adding cost to http proxy. If "errors" was the first field, it would have been much easier for http streaming proxy to buffer first few bytes of the response, look for errors if not found continue with streaming. Current implementations do not work well with streaming proxy, in addition adds extra cost of parsing "data" just for detecting "errors".

@IvanGoncharov
Copy link
Member

IvanGoncharov commented May 17, 2018

If "errors" was first field followed by "data", it would be easier for http proxies to parse initial few bytes of response and detect errors.

It's partly addressed by #384 and included in the upcoming release:
http://facebook.github.io/graphql/draft/#sec-Response-Format
Note that currently it's only a recomendation.

@IvanGoncharov
Copy link
Member

@monikasoni Can I close this issue?

@monikasoni
Copy link
Author

Thanks for the response @IvanGoncharov.

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

No branches or pull requests

2 participants