app.use(async (ctx, next) => { if (ctx.method === 'OPTIONS') { ctx.set('Access-Control-Allow-Methods', 'PUT,DELETE,POST,GET'); ctx.set('Access-Control-Max-Age', 3600 * 24); ctx.body = ''; } await next();});
这样就减少了多余的响应头。
2023-03-10
0万阅读
2023-02-23
3万阅读
2023-02-09
7万阅读
2023-01-08
4万阅读
2022-12-26
2万阅读
2022-12-22
1万阅读
2022-12-12
2022-12-10
5万阅读