And*_*ren 9 http http-headers express
我一直在玩express.js试图返回简单的json对象,并注意到即使我明确设置了Content-Type标题,application/json它只在第一个响应时可见,当状态代码是200时.每个跟随304的响应都没有Content-Type标题.
我的代码示例:
app.get('/user', function (req, res) {
res.set('Content-Type', 'application/json');
res.send([
{ user: "john", email: "john@example.com"},
{ user: "marry", email: "marry@example.com"},
{ user: "dan", email: "dan@example.com"}
]);
});
Run Code Online (Sandbox Code Playgroud)
这是什么原因?
| 归档时间: |
|
| 查看次数: |
1399 次 |
| 最近记录: |