springboot2X版本使用DeleteMappingvalue = deleteHost前端使用this$postodasettingsdeleteHost_method delete请求报错orgspringframeworkwebHttpRequestMethodNotSupportedException Request method POST not supported at orgs
根据错误信息,您的后端代码中使用了@DeleteMapping注解来处理DELETE请求,但是前端却发送了一个POST请求。这导致了请求方法不匹配的错误。
要解决这个问题,您可以尝试以下解决方案:
- 将前端的请求方式改为DELETE请求。在您的前端代码中,将请求方式从"POST"改为"DELETE"。
this.$delete("/oda/settings/deleteHost", ...)
- 更改后端代码,将
@DeleteMapping注解替换为@PostMapping或@RequestMapping。
@PostMapping(value = "/deleteHost")
或者
@RequestMapping(value = "/deleteHost", method = RequestMethod.DELETE)
这样,后端将能够处理POST请求并且不会报错。
请根据您的实际情况选择适合的解决方案。
原文地址: http://www.cveoy.top/t/topic/i0ol 著作权归作者所有。请勿转载和采集!