0
点赞
收藏
分享

微信扫一扫

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


1、问题描述

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

前端报错信息:

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED_vue.js


后端报错信息:

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED_接口设计_02

2、问题分析

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

3、问题源头

前端调用后台接口的方法

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED_接口设计_03

4、解决方法

修改调用后台接口的方法

前端调用后台接口

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


后台接口设计

Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED_报错信息_05

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

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


举报

相关推荐

Failed to load class

0 条评论