Node.js 在node/express js中放置/删除来自Firefox和Safari的请求

Node.js 在node/express js中放置/删除来自Firefox和Safari的请求,node.js,express,put,Node.js,Express,Put,我有一个node/express应用程序,当从Firefox/Safari调用时,在点击选项后,我看不到请求进入PUT或DELETE 以下是我的应用程序配置: var app = express(); app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Req

我有一个node/express应用程序,当从Firefox/Safari调用时,在点击选项后,我看不到请求进入PUT或DELETE

以下是我的应用程序配置:

var app = express();

app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, DELETE");
    next();
});
我正在使用fetch调用api

fetch('http://localhost:3001/api/testapi/' + id, {
          method: 'PUT',
          headers: {
              'Accept': 'application/json',
              'Content-Type': 'application/json',
          },
          body: JSON.stringify({
              testDetails: testInfo,
          })
      })

GET和POST请求在所有浏览器中都能正常工作。我不明白为什么PUT和DELETE请求在Firefox和Safari中不能工作。有人能帮忙吗?

你是如何调用API的?fetch(“”+id,{method:'PUT',headers:{Accept':'application/json',Content Type':'application/json',},body:json.stringify({testDetails:testInfo,})})您能否共享负责处理put和delete方法的中间件?另外,你知道firefox和safari会给你带来什么错误吗?还是应用程序级错误?