koa status 204的问题

当设置ctx.body=undefined时,ctx.status会自动设置为204,即使ctx.body再次赋值时这个值也不会变

ctx.body = undefined;
console.log(ctx.status); // 204
ctx.body = 'success';
console.log(ctx.status); // 204

结果这个请求没有响应数据

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章