request method ‘DELETE‘ not supported报错处理
前端请求:
//删除用户请求
export function deteleUser(id){console.log('要删除的用户ID'+id);return request({url:'/user/'+id,method:'delete',// data:id})
}
后端:
@DeleteMapping@Log(title = "删除用户",businessType = "用户操作")public ResponseEntity<Boolean> deleteById(Long id) {System.out.println(id);return ResponseEntity.ok(this.userService.deleteById(id));}
运行以上代码报405
错误,request method ‘DELETE‘ not supported
1、报错原因
前端发送的rest 请求和后端的响应不匹配。
参数是从路径中获取的,前端发送请求时需要将参数一同带入到url中发送到后端
2、解决方案
检查前后端代码,发现出错在后端
使用@PathVariable
注解映射URL绑定的占位符并在@DeleteMapping
后增加请求参数
@DeleteMapping("{id}")@Log(title = "删除用户",businessType = "用户操作")public ResponseEntity<Boolean> deleteById(@PathVariable("id") Long id) {System.out.println(id);return ResponseEntity.ok(this.userService.deleteById(id));}
request method ‘DELETE‘ not supported报错处理相关推荐
- 【SpringBoot的坑】Restful请求报错Request method 'POST' not supported,HiddenHttpMethodFilter无法将POST转换为PUT原因分析
直接上结论: 因为 SpringBoot 版本原因,在我目前使用的 2.2.4 版本中,需要在springapplication.xml文件中 添加配置: spring.mvc.hiddenmetho ...
- security工作笔记006---oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决
JAVA技术交流QQ群:170933152 最近做智慧城市项目,太恶心了...各种不会,个人负责权限验证中心服务,...唉,慢慢研究吧.. 报错信息 <MethodNotAllowed> ...
- postman发送post请求,服务器日志确保GET请求错误“ PageNotFound:208 Request method ‘GET‘ not supported”
一.事件经过 这段时间在配置菲律宾项目上k8s,今天在测试生产环境时,报了一个错: PageNotFound:208 Request method 'GET' not supported.意思是:请求 ...
- Request method 'GET' not supported解决方式
There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor ...
- 警告: Request method ‘POST‘ not supported。的原因之一——空格毁一生
操作中突然报 Request method 'POST' not supported 错 检查ip.端口.请求地址."传的参数".都正确.甚至在其他地方都可以正常调成功 仔细检查后 ...
- 我遇到的问题之request method ‘post’ not supported
文章目录 我遇到的问题之request method 'post' not supported 背景 尝试解决 源码大法好 总结 我遇到的问题之request method 'post' not su ...
- 解决Request method 'POST' not supported问题
问题: login.html中表单提交方式为POST. 用户登录Controller层直接跳转login.html,可以跳转,但若登录用户名或密码错误再次跳转login.html,则报错:Reques ...
- org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported
错误描述: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not suppo ...
- xlrd.biffh.XLRDError: Excel xlsx file; not supported报错
xlrd.biffh.XLRDError: Excel xlsx file: not supported报错 **原因是最近xlrd更新到了2.0.1版本,只支持.xls文件.所以pandas.rea ...
- 今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2...
今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2 查官方文档 解决方法 在 PowerShell中运行以下内容, 然后重启服务器 # Enab ...
最新文章
- ATS 5.3.0中自定义日志格式文件logs_xml.config解读
- OSPF-stub/totaly stub
- @NotEmpty,@NotNull和@NotBlank的区别
- oracle输出查询返回多行,ORA-01427:单行子查询返回多行
- rest spring_Spring REST:异常处理卷。 3
- windows mysql4.1安装_Windows下,MySql的安装及配置(Install and Config of MySQL in Windows)...
- ibm mq qname java_IBMMQ 从队列获取消息并将消息发送到特定主题上面
- ORA-01502-对应的快速解决办法(索引或这类索引的分区处于不可用状态)
- 主题模型TopicModel:PLSA模型及PLSA的EM推导
- 唯一分解定理 详解(C++)
- GBase项目管理实践总结——WBS分解的关键事项
- 教务系统自动评教_FAFU教务管理系统
- 计算机木材染色 配色技术的应用技术,木材怎么染色?木材染色剂电脑配色方法...
- iso硬盘安装 凤凰os_凤凰系统安装教程-凤凰虚拟机2.0(Phoenix OS)下载v3.6.1可重启版-西西软件下载...
- ubuntu安装搜狗拼音输入法
- 邮件退回 对方服务器不允许,主 题:我给别人发的邮件被退回来了如何处理?...
- 百度云(网)加速器下载
- pandas中强大的绘制图表功能——DataFrame.hist(),以及统计分析函数——DataFrame.describe()
- 使用钉钉Api 向企业群发送文件 python
- Python用MCMC马尔科夫链蒙特卡洛、拒绝抽样和Metropolis-Hastings采样算法
热门文章
- STM32名字含义以及其与ARM公司的关系
- linux关机卡屏,Ubuntu关机卡住无法关机的解决方法
- 【Unity】基于顶点色的海边波浪效果(适用移动端)
- jQuery ajax 文件下载
- mysql like 原理_MySql原理
- 计算机主机自动关机如何设置,如何设置电脑自动关机
- python爬取和平精英皮肤_Python——LOL官方商城皮肤信息爬取(一次练手)
- Survey of Aspect-based Sentiment Analysis Datasets
- 美国弗吉尼亚大学计算机科学,弗吉尼亚大学UVa计算机科学Computer Science专业排名第201-250位(2021年THE世界大学商科排名)...
- html写前端手机页面,前端编写手机兼容页面(简易方式)