Getting 405 method not found for Put request

问题描述 投票:0回答:0

我正在处理更新一些数据的 put 调用,但 ut 抛出 405 方法未找到错误。但是当我尝试使用 post call 时,它工作正常。我也想将它与 put call 一起使用。

const opts = {
  headers: {
   'Content-Type': 'application/json',
   'Access-Control-Allow-Methods': '*',
   'Access-Control-Allow-Credentials': true,
   'Access-Control-Allow-Headers': 'X-Requested-With,content-type',
   httpsAgent: new Agent({
      rejectUnauthorized: false
        }), //CORS i tried to add 
   Accept: '*/*',
   Authorization: auth ,
   },
   method: 'PUT'  
}

return axios.put(endpoint, parameter, opts)
  .then((response) => {
    console.log(response);
   })
  .catch((err) => {
    console.log(err)
  });

Put call 应该有效。我尝试过邮寄电话,但那行得通。我尝试更改标题但没有运气。

node.js axios put
© www.soinside.com 2019 - 2024. All rights reserved.