lsc 1 hafta önce
ebeveyn
işleme
1d63889d31
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. 3 0
      app.js

+ 3 - 0
app.js

@@ -40,6 +40,9 @@ app.use(function (req, res, next) {
     res.header('X-Powered-By', ' 3.2.1')
     //内容类型:如果是post请求必须指定这个属性
     res.header('Content-Type', 'application/json;charset=utf-8')
+    if (req.method === 'OPTIONS') {
+        return res.sendStatus(204);
+    }
     next();
 });