天天看點

項目報錯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"

繼續閱讀