-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Milestone
Description
const Koa = require('koa');
const app = new Koa();
app.use(ctx => {
ctx.set('Content-Type', 'application/vnd.myapi.v1+json');
ctx.body = {message: 'hello'};
});
app.listen(3000);
When running this code I aways get Content-Type: application/json; charset=utf-8
.
I can make it work if I write the header after setting the body. It only affects json
responses. I'm not sure if that's a bug, but I couldn't find any information about that behavior in documentation.
nerdyman, pmjhonwang and yhlchao