我正在使用apollo,并将查询发送到服务器。我可以看到服务器的响应,即使状态为console.log
也没有内容,我仍然可以204
进行响应。
但是为什么我没有得到任何标题信息?
这是我使用客户端进行测试时的回答。
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 0
Date: Sun, 25 Nov 2018 04:02:47 GMT
Vary: Access-Control-Request-Headers
X-Powered-By: Express
但是它在邮递员中正常工作:
X-Powered-By Express
Access-Control-Allow-Origin *
Set-Cookie accessToken=...; Max-Age=3000; Path=/; Expires=Sun, 25 Nov 2018 04:33:26 GMT; HttpOnly
Set-Cookie refreshToken=...; Max-Age=3000; Path=/; Expires=Sun, 25 Nov 2018 04:33:26 GMT; HttpOnly
Content-Type application/json; charset=utf-8
Content-Length 104
ETag W/"68-5L4bPmWT9FPXmAdGj2wrUW6Ei/Y"
Date Sun, 25 Nov 2018 03:43:26 GMT
Connection keep-alive
这是我的服务器代码:
const app = express();
app.use(cors());
app.use(logger('tiny'));
app.use(cookieParser());
app.use(
'/api/graphql',
expressGraphQL((req, res) => ({
schema,
graphiql: true,
context: {
req,
res
}
}))
);
app.use(
bodyParser.urlencoded({
extended: true
})
);
app.use(router);
答案 0 :(得分:0)
在“网络”标签中,单击all
而不是xhr