Post GraphQL服务器响应可以获取,但不能发布
在Hapi上配置的graphql服务器响应良好,可以获取请求:Post GraphQL服务器响应可以获取,但不能发布,post,http-status-code-404,response,graphql,graphql-js,Post,Http Status Code 404,Response,Graphql,Graphql Js,在Hapi上配置的graphql服务器响应良好,可以获取请求: http://127.0.0.1:8000/graphql?query={content(id:"13381672"){title,id}} { "data": { "content": { "title": "Brooks Brothers Pre-Fall 2016", "id": "13381672" } } } 但是…404使用POST: curl -X POST -d '
http://127.0.0.1:8000/graphql?query={content(id:"13381672"){title,id}}
{
"data": {
"content": {
"title": "Brooks Brothers Pre-Fall 2016",
"id": "13381672"
}
}
}
但是…404使用POST:
curl -X POST -d '{"query":"{content(id:\"13381672\"){title,id}}"}' http://127.0.0.1:8000/graphql --header "Content-Type:application/json"
{"statusCode":"404"}
以下是为Hapi配置的路线:
{
method: ['GET', 'POST'],
path: '/graphql',
config: {
handler: handlers.graphql,
tags: [
'graphql'
]
}
}
在注意到从相关Hapi控制器中的函数返回的有效负载为空后,我对其进行了调整,以正确响应POST有效负载和GET查询字符串