1: 响应头中间件
1.1: 第二层中间件
1.2: 获取mine 类型
application/json
3: 设置响应头
COntent-Type: application/json; chartset= UTF-8
------------------------------------------------------
// 响应头的中间件
module.exports = async (ctx, next)=> {
const contentType = 'application/json; chartset=utf-8'
ctx.set('Content-Type', contentType)
ctx.response.body = '{"success": true}'
await next()
}
响应头中间件
最新推荐文章于 2023-08-17 15:55:03 发布