Closed yarick123 closed 3 years ago
It will not work this way since httpyac is not a fork of vscode-restclient and the hack with the request header is intentionally not implemented. I want to support graphql even better, but for now that JSON still needs to be created manually.
POST {{server}}
Content-Type: application/json
{
"query": "{test(id: 95, url: "/test95") { Url Name }}"
}
My current idea would be to implement the following format.
POST {{server}}
Content-Type: application/json
gql`
query HeroNameAndFriends {
hero {
name
friends {
name
}
}
}
`
However, I want to read through the specification more before implementing this so I don't overlook special cases like graphql fragments.
I need to dig deeper into graphql and be able to run a use case. I am grateful for help.
I have discarded the idea with gql`. With the new version the query should work without the X-REQUEST-TYPE header. Fragments are also supported.
fragment IOParts on Repository {
description
diskUsage
}
POST https://api.github.com/graphql
Content-Type: application/json
Authorization: Bearer {{git_api_key}}
query repositoryQuery($name: String!, $owner: String!) {
repository(name: $name, owner: $owner) {
name
fullName: nameWithOwner
...IOParts
forkCount
watchers {
totalCount
}
}
}
{
"name": "vscode-httpyac",
"owner": "AnWeber"
}
I tried the GraphQL with the extension exactly the same way as by vscode-restclient:
but got an error message, that the json is incorrect. Could you please show an working sample of GraphQL querying with the extension?
P.S. I used the extension version 1.6.0 on vscode 1.53.0 on windows