更新 'app.js'

This commit is contained in:
luyuan 2021-03-15 16:03:33 +08:00
parent 5fa9fd13f2
commit d0868e6043

1
app.js
View File

@ -42,6 +42,7 @@ app.use(async (ctx, next) => {
// 需要获取其他字段时使用Access-Control-Expose-Headers // 需要获取其他字段时使用Access-Control-Expose-Headers
// getResponseHeader('myData')可以返回我们所需的值 // getResponseHeader('myData')可以返回我们所需的值
//https://www.rails365.net/articles/cors-jin-jie-expose-headers-wu //https://www.rails365.net/articles/cors-jin-jie-expose-headers-wu
console.log(ctx.request.body)
ctx.set("Access-Control-Expose-Headers", "myData"); ctx.set("Access-Control-Expose-Headers", "myData");
if(ctx.method == "OPTIONS"){ if(ctx.method == "OPTIONS"){
ctx.body = "" ctx.body = ""