관리 메뉴

JIE0025

[HTTP] 405 Method Not Allowed 본문

백엔드/이슈, 트러블슈팅

[HTTP] 405 Method Not Allowed

Kangjieun11 2022. 12. 17. 02:12
728x90

 

 

요청메세지를 날렸는데 405가 나왔다. 

 

WARN 15231 --- [nio-8080-exec5] o.s.web.servlet.PageNotFound  : Request method 'PATCH' not supported

WARN 15231 --- [nio-8080-exec-5] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PATCH' not supported]

WARN 15231 --- [nio-8080-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.bind.MissingPathVariableException: Required URI template variable '{category-id}' for method parameter type long is not present]

 

 

 

✅ 문제

 

알아보니까 허용되지 않는 메서드로 정의하고 있고, 요청줄에 지정된 메서드가 요청 URI로 식별되는 리소스에 허용이 되지 않는 상태라고 하는데

 

결론은 메서드매칭이 잘못되었다는 뜻

 

 

보니까 요청을 http://localhost:8080/v1/categories/1   이걸로 날렸으면서 URI 매핑을 안해준게 실수다.

 

✅  해결

 

 

 

 

 

References

https://cocoon1787.tistory.com/824