天天看点

项目报错405 error: "Method Not Allowed" message: "Request method 'DELETE' not supported"

项目报错405 error: "Method Not Allowed" message: "Request method 'DELETE' not supported"

找了很久的错误,要吐血了,发现自己后端SpringBoot用的是RESTful风格,而后端用的是get请求。

后端:

@DeleteMapping("/article/{id}")
	@ResponseBody
	public String deleteArticleById(@PathVariable("id") Integer id) {
            articleService.deleteArticleById(id);
            return "success" ;
	}
           

前端:

正确的url应该是:

这样,问题就解决了。

项目报错405 error: "Method Not Allowed" message: "Request method 'DELETE' not supported"

继续阅读