如何在graphql中获取响应的状态代码?
我用于graphql服务器,我想在如何在graphql中获取响应的状态代码?,graphql,graphql-js,express-graphql,Graphql,Graphql Js,Express Graphql,我用于graphql服务器,我想在formatResponse下提取一个状态代码: Query: { get_foo: () => { return fetch(URL).then(res => res.json()); }, 我试图打印这两个res,req,但是响应(res)没有存储状态代码字段 const options = { ... // A function applied to each response after execut
formatResponse
下提取一个状态代码:
Query: {
get_foo: () => {
return fetch(URL).then(res => res.json());
},
我试图打印这两个res,req
,但是响应(res
)没有存储状态代码字段
const options = {
...
// A function applied to each response after execution
formatResponse,
};
const formatResponse = (res) => {
console.log(res);
};