From f2678b4a103fa0205d6d30de69fff76ae00f05ee Mon Sep 17 00:00:00 2001 From: sarukuku Date: Wed, 4 Apr 2018 16:26:57 +0300 Subject: [PATCH 1/2] Add content type header to curl. This fixes #264. --- examples/03-server/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/03-server/README.md b/examples/03-server/README.md index ee36ccb..0618cf1 100644 --- a/examples/03-server/README.md +++ b/examples/03-server/README.md @@ -10,10 +10,10 @@ php -S localhost:8080 ./graphql.php ### Try query ``` -curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }' +curl -H "Content-Type: application/json" -d '{"query": "query { echo(message: \"Hello World\") }" }' http://localhost:8080 ``` ### Try mutation ``` -curl http://localhost:8080 -d '{"query": "mutation { sum(x: 2, y: 2) }" }' +curl -H "Content-Type: application/json" http://localhost:8080 -d '{"query": "mutation { sum(x: 2, y: 2) }" }' ``` From 9b94ac2f06a727b25338b3223300880f41341b46 Mon Sep 17 00:00:00 2001 From: sarukuku Date: Wed, 4 Apr 2018 16:34:05 +0300 Subject: [PATCH 2/2] Better argument order for curl. Related to #264. --- examples/03-server/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/03-server/README.md b/examples/03-server/README.md index 0618cf1..4737d6e 100644 --- a/examples/03-server/README.md +++ b/examples/03-server/README.md @@ -10,10 +10,10 @@ php -S localhost:8080 ./graphql.php ### Try query ``` -curl -H "Content-Type: application/json" -d '{"query": "query { echo(message: \"Hello World\") }" }' http://localhost:8080 +curl -d '{"query": "query { echo(message: \"Hello World\") }" }' -H "Content-Type: application/json" http://localhost:8080 ``` ### Try mutation ``` -curl -H "Content-Type: application/json" http://localhost:8080 -d '{"query": "mutation { sum(x: 2, y: 2) }" }' +curl -d '{"query": "mutation { sum(x: 2, y: 2) }" }' -H "Content-Type: application/json" http://localhost:8080 ```