GraphQL突变体分析器

刚刚更新为“graphql服务器-Express的1.3.0版本和运行任何突变时,现在我收到此错误:GraphQL突变体分析器

POST body missing. Did you forget use body-parser middleware? 

当初始化服务器,我在内的” body-parser“包,所以我不确定这里发生了什么。有任何想法吗?

服务器配置:

//GraphQL Server 

graphQLServer.use(

//GRAPHQL Endpoint

`/${settings.public.graphql.endpoint}`,

//Parse JSON

bodyParser.json(),

//authenticate

authenticateRequest,

//GRAPHQL Server

graphqlExpress(req => {

return {

schema: schema,

context: req

}

})

);

示例请求:

curl 'http://localhost:5050/graphql' \ 

-H 'authorization: Bearer xxxxxxxxxxx.xxxxxxxxxxx' \

-d '{

"query": "mutation { sensorData(sensorValue: \u0027asdasdasdasd \u0027)}",

"variables": {}

}

}'

回答:

的请求(docs)

curl 'http://localhost:5050/graphql' \ 

-H "Content-Type: application/json" \

-H 'authorization: Bearer xxxxxxxxxxx.xxxxxxxxxxx' \

-d '{

"query": "mutation { sensorData(sensorValue: \u0027asdasdasdasd \u0027)}",

"variables": {}

}

}'

以上是 GraphQL突变体分析器 的全部内容, 来源链接: utcz.com/qa/260636.html

回到顶部