Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED
  TEZNKK3IfmPf 2023年11月12日 21 0

技术栈:前后端项目分离(Springboot+Vue+MybatisPlus)

前端报错信息:

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED

 

后端报错信息:

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED

2、问题分析

这里使用了ResultFul风格的接口设计方式、增删改查对应不同的方法请求、这里错误使用了方法请求导致

3、问题源头

前端调用后台接口的方法

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED

4、解决方法

修改调用后台接口的方法

前端调用后台接口

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED

 

后台接口设计

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED

5、知识扩展(认识HTTP方法与CRUD动作映射)

动作

普通的CRUD的url

普通的CRUD的HTTP方法

RestFul的URL

RestFul的HTT方法

查询

Article/id=1

GET

Article/{id}

GET

添加

Article?title=xxx&body=xxx

GET/POST

Article

POST

修改

Article/update?id=xxx

GET

Article/{id}

PUT/PATCH

删除

Article/delete?id=xxx

GET

Article/{id}

DELETE

 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月12日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   22天前   25   0   0 接口
TEZNKK3IfmPf