You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/09 05:17:28 UTC

[GitHub] [apisix] pcyan edited a comment on issue #6266: bug: ctx.lua#59 parse_graphql(ctx)

pcyan edited a comment on issue #6266:
URL: https://github.com/apache/apisix/issues/6266#issuecomment-1033360012


   > In fact, I tested both commands locally and they worked
   > 
   > config
   > 
   > ```
   > curl http://127.0.0.1:9080/apisix/admin/routes/7 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   > {
   >     "methods": ["POST"],
   >     "name":"mockGetUser",
   >     "uri": "/graphql",
   >     "vars": [
   >         ["graphql_operation", "==", "query"],
   >         ["graphql_name", "==", "getUser"]
   >     ],
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "127.0.0.1:1980": 1
   >         }
   >     }
   > }'
   > ```
   > 
   > curl command
   > 
   > ```
   > curl -X POST http://127.0.0.1:9080/graphql -d '
   > query getUser {
   >     owner {
   >         name
   >     }
   >     repo {
   >         created
   >     }
   > }'
   > ```
   > 
   > It could be that you missed '-POST'?
   
   A standard GraphQL POST request should use the application/json content type, and include a JSON-encoded body of the following form:
   ```json
   {
     "query": "...",
     "operationName": "...",
     "variables": { "myVariable": "someValue", ... }
   }
   ```
   see official graphql document
   
   and `--data` will perform request as `POST` method ,see `curl` document


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org