-
Notifications
You must be signed in to change notification settings - Fork 520
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
graphql variables serialize as a string and not json #1218
Comments
Good catch and thanks for the detailed issue. We will try to do a quick patch asap. |
@jcamiel thanks and btw, this tool is awesome. My company is going to be looking to invest in usage of this tool for our e2e testing story. So far this looks perfect. I'm not technically blocked on this issue as I'm able to gracefully degrade back to json requests
but having the new native gql support will make for a much nicer authoring experience for our engineers |
@softprops would you be kind to test my fix on |
@jcamiel worked like a charm! POST http://localhost:8080 ApolloGraphql-Client-Name: hurl-test [Options] retry: true ```graphql query testMember($id: ID!) { member(id: $id) { name } } variables { "id": "{{member_id}}" } ```
|
I'll keep an eye out for the next release. Thanks! |
@softprops We've released a 2.0.1, should be available on the various packet managers soon |
Summary
when hurl constructs a request from a graphql query containing variables it correctly generates a json both with "query" and "variables" keys however the value assigned to "variables" is serialized as a string and not as a json object as most graphql servers expect
Steps to reproduce
use the graphql example from the readme and run hurl with the
--verbose
flag capturing the curl example it generatesnote how "variables" is a string and not json
"variables":"{\n \"episode\": \"JEDI\",\n \"withFriends\": false\n}"
Example Project
What is the current bug behavior?
"variables" objects in json encoded requests is a string
What is the expected correct behavior?
most servers will expect "variables" as a json object something more like this
"variables":{ "episode": "JEDI", "withFriends": false}
this is also what is described by graphql.org https://graphql.org/learn/serving-over-http/#post-request
Relevant logs and/or screenshots
Output of checks
hurl --version
):osx
Possible fixes
The text was updated successfully, but these errors were encountered: