前端请求:

//删除用户请求
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报错处理相关推荐

  1. 【SpringBoot的坑】Restful请求报错Request method 'POST' not supported,HiddenHttpMethodFilter无法将POST转换为PUT原因分析

    直接上结论: 因为 SpringBoot 版本原因,在我目前使用的 2.2.4 版本中,需要在springapplication.xml文件中 添加配置: spring.mvc.hiddenmetho ...

  2. security工作笔记006---oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决

    JAVA技术交流QQ群:170933152 最近做智慧城市项目,太恶心了...各种不会,个人负责权限验证中心服务,...唉,慢慢研究吧.. 报错信息 <MethodNotAllowed> ...

  3. postman发送post请求,服务器日志确保GET请求错误“ PageNotFound:208 Request method ‘GET‘ not supported”

    一.事件经过 这段时间在配置菲律宾项目上k8s,今天在测试生产环境时,报了一个错: PageNotFound:208 Request method 'GET' not supported.意思是:请求 ...

  4. Request method 'GET' not supported解决方式

    There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor ...

  5. 警告: Request method ‘POST‘ not supported。的原因之一——空格毁一生

    操作中突然报 Request method 'POST' not supported 错 检查ip.端口.请求地址."传的参数".都正确.甚至在其他地方都可以正常调成功 仔细检查后 ...

  6. 我遇到的问题之request method ‘post’ not supported

    文章目录 我遇到的问题之request method 'post' not supported 背景 尝试解决 源码大法好 总结 我遇到的问题之request method 'post' not su ...

  7. 解决Request method 'POST' not supported问题

    问题: login.html中表单提交方式为POST. 用户登录Controller层直接跳转login.html,可以跳转,但若登录用户名或密码错误再次跳转login.html,则报错:Reques ...

  8. org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported

    错误描述: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not suppo ...

  9. xlrd.biffh.XLRDError: Excel xlsx file; not supported报错

    xlrd.biffh.XLRDError: Excel xlsx file: not supported报错 **原因是最近xlrd更新到了2.0.1版本,只支持.xls文件.所以pandas.rea ...

  10. 今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2...

    今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2 查官方文档 解决方法 在 PowerShell中运行以下内容, 然后重启服务器 # Enab ...

最新文章

  1. ATS 5.3.0中自定义日志格式文件logs_xml.config解读
  2. OSPF-stub/totaly stub
  3. @NotEmpty,@NotNull和@NotBlank的区别
  4. oracle输出查询返回多行,ORA-01427:单行子查询返回多行
  5. rest spring_Spring REST:异常处理卷。 3
  6. windows mysql4.1安装_Windows下,MySql的安装及配置(Install and Config of MySQL in Windows)...
  7. ibm mq qname java_IBMMQ 从队列获取消息并将消息发送到特定主题上面
  8. ORA-01502-对应的快速解决办法(索引或这类索引的分区处于不可用状态)
  9. 主题模型TopicModel:PLSA模型及PLSA的EM推导
  10. 唯一分解定理 详解(C++)
  11. GBase项目管理实践总结——WBS分解的关键事项
  12. 教务系统自动评教_FAFU教务管理系统
  13. 计算机木材染色 配色技术的应用技术,木材怎么染色?木材染色剂电脑配色方法...
  14. iso硬盘安装 凤凰os_凤凰系统安装教程-凤凰虚拟机2.0(Phoenix OS)下载v3.6.1可重启版-西西软件下载...
  15. ubuntu安装搜狗拼音输入法
  16. 邮件退回 对方服务器不允许,主 题:我给别人发的邮件被退回来了如何处理?...
  17. 百度云(网)加速器下载
  18. pandas中强大的绘制图表功能——DataFrame.hist(),以及统计分析函数——DataFrame.describe()
  19. 使用钉钉Api 向企业群发送文件 python
  20. Python用MCMC马尔科夫链蒙特卡洛、拒绝抽样和Metropolis-Hastings采样算法

热门文章

  1. STM32名字含义以及其与ARM公司的关系
  2. linux关机卡屏,Ubuntu关机卡住无法关机的解决方法
  3. 【Unity】基于顶点色的海边波浪效果(适用移动端)
  4. jQuery ajax 文件下载
  5. mysql like 原理_MySql原理
  6. 计算机主机自动关机如何设置,如何设置电脑自动关机
  7. python爬取和平精英皮肤_Python——LOL官方商城皮肤信息爬取(一次练手)
  8. Survey of Aspect-based Sentiment Analysis Datasets
  9. 美国弗吉尼亚大学计算机科学,弗吉尼亚大学UVa计算机科学Computer Science专业排名第201-250位(2021年THE世界大学商科排名)...
  10. html写前端手机页面,前端编写手机兼容页面(简易方式)