GraphQL クエリで POST リクエストを作成しようとしていますMust provide query string
が、リクエストが PostMan で機能しているにもかかわらず、エラーが返されます。
PostMan で実行する方法は次のとおりです。
そして、これが私のアプリケーションで実行しているコードです:
const url = `http://localhost:3000/graphql`;
return fetch(url, {
method: 'POST',
Accept: 'api_version=2',
'Content-Type': 'application/graphql',
body: `
{
users(name: "Thomas") {
firstName
lastName
}
}
`
})
.then(response => response.json())
.then(data => {
console.log('Here is the data: ', data);
...
});
私が間違っていることはありますか?リクエストで渡す body 属性が、PostMan リクエストの本文で指定したようにfetch
フォーマットされるようにすることは可能ですか?Text