Rails 如何使用 fetch 发送 delete 请求

zeekerpro · July 10, 2019 · Last by zeekerpro replied at July 11, 2019 · 4765 hits

我尝试使用 fetch 给 rails 后台发送 delete 请求,如下所示

路由如下:

发送请求时报错如下:

这是什么问题导致的,该怎么解决。

我的写法是参考这里:

https://www.freecodecamp.org/news/a-practical-es6-guide-on-how-to-perform-http-requests-using-the-fetch-api-594c3d91a547/

服务器端返回的不符合期望,就要去看服务期端的日志,看为什么会产生这样的响应

Reply to jasl

谢谢提醒,找到问题了,Can't verify CSRF token authenticity。

解决方法

zeekerpro closed this topic. 11 Jul 06:33
You need to Sign in before reply, if you don't have an account, please Sign up first.