小编Car*_*ara的帖子

Angular 7:发送帖子请求给出错误 405(方法不允许)

我在 Chrome 上有 CORS 扩展并且 GET 请求工作正常但 POST 请求没有。我收到错误“方法不允许”,但由于我有 CORS 扩展,根据文档,POST 请求应该可以工作。

我尝试使用另一个主题中提到的可选标头,但错误仍然存​​在。

我使用这个代码:

send(id){
    let list = JSON.stringify(this.array)
    this.http.post(this.url + this.id, list)
         .subscribe(),
            error => console.log("Error: ", error)
    )
} 
Run Code Online (Sandbox Code Playgroud)

浏览器控制台中的错误消息是:

消息:http://localhost:4000/ 的Http 失败响应...
名称:“HttpErrorResponse”
ok:false
status:405
statusText:“Method Not Allowed”

post http http-status-code-405 angular

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

http ×1

http-status-code-405 ×1

post ×1