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

added support for GraphQL #384

Merged
merged 4 commits into from
Jul 9, 2019
Merged

added support for GraphQL #384

merged 4 commits into from
Jul 9, 2019

Conversation

ferronrsmith
Copy link
Contributor

No description provided.


let graphQlPayload = {
query: body,
variables: JSON.parse(variables.toString())
Copy link
Owner

Choose a reason for hiding this comment

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

If no variables provided, do we still need to serialize this, or if we included variables: null in the payload, will the GraphQL server allow this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it still needs to be sent. I've never personally used a request without variables, but I'll add a default state

Repository owner deleted a comment from ferronrsmith Jul 9, 2019

let graphQlPayload = {
query: body,
variables: variables ? JSON.parse(variables.toString()) : {}
Copy link
Owner

Choose a reason for hiding this comment

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

Or the variables should be omitted if variables not provided? I think the variables field is optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, my comment got deleted. Some GraphQL servers do schema validation checks for {query,variables}. I'd rather send it, even if it's empty.

Copy link
Owner

Choose a reason for hiding this comment

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

Got

Copy link
Owner

@Huachao Huachao left a comment

Choose a reason for hiding this comment

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

Thanks, really nice patch

@Huachao Huachao merged commit f0a56b9 into Huachao:master Jul 9, 2019
@Huachao
Copy link
Owner

Huachao commented Jul 9, 2019

@ferronrsmith Merged, thanks

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.

2 participants