Getting 405 method not found for Put request

编程入门 行业动态 更新时间:2024-10-04 07:24:27

Getting 405 <a href=https://www.elefans.com/category/jswz/34/1768718.html style=method not found for Put request"/>

Getting 405 method not found for Put request

我正在处理更新一些数据的 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 应该有效。我尝试过邮寄电话,但那行得通。我尝试更改标题但没有运气。

回答如下:

更多推荐

Getting 405 method not found for Put request

本文发布于:2024-05-31 03:45:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1771237.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:method   request   Put

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!