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

GraphQL queries without variables fail to execute #124

Closed
staff0rd opened this issue Nov 22, 2021 · 2 comments
Closed

GraphQL queries without variables fail to execute #124

staff0rd opened this issue Nov 22, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@staff0rd
Copy link
Contributor

staff0rd commented Nov 22, 2021

Repro

For this file:

POST https://api.spacex.land/graphql
Content-Type: application/json

query company_query {
  company {
    coo
  }
}

run httpyac test.http --all

Expected

{
  "data": {
    "company": {
      "coo": "Gwynne Shotwell"
    }
  }
}

Actual

POST https://api.spacex.land/graphql
accept: */*
accept-encoding: gzip, deflate, br
content-length: 47
content-type: application/json
user-agent: httpyac

query company_query {
  company {
    coo
  }
}

HTTP/1.1 400  - Bad Request
access-control-allow-origin: *
connection: close
content-length: 138
content-security-policy: default-src 'none'
content-type: text/html; charset=utf-8
date: Mon, 22 Nov 2021 13:38:10 GMT
server: Cowboy
via: 1.1 vegur
x-content-type-options: nosniff
x-powered-by: Express

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Bad Request</pre>
</body>
</html>
AnWeber added a commit to httpyac/httpyac.github.io that referenced this issue Nov 22, 2021
@AnWeber
Copy link
Owner

AnWeber commented Nov 22, 2021

There were 2 errors present. If the file did not have a blank line at the end of the body, it was not treated as a correct GQL body. And requests without body were not extended with the query JSON.

@AnWeber AnWeber added the bug Something isn't working label Nov 22, 2021
@AnWeber
Copy link
Owner

AnWeber commented Nov 23, 2021

I have published a bugfix. Thanks

@AnWeber AnWeber closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants