【发布时间】:2023-02-21 06:00:21
【问题描述】:
我正在尝试调用 hasnode API 以获取博客作为响应,正文在 GraphQL 中。但是我在“网络选项卡”中收到此错误“POST 正文丢失。你忘记使用 body-parser 中间件了吗? `
let query = `
{
user(username: "singhmona") {
publication {
posts{
slug
title
brief
coverImage
}
}
}
}
`;
let body = JSON.stringify({
query
});
axios
.post('https://api.hashnode.com/',
body,
{
'content-type': 'application/json',
})
.then(response => {
this.info = response;
console.log(response);}
)
`
【问题讨论】: