mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
SPR-4927 - Return 405 instead of 404 when HTTP method is not supported
This commit is contained in:
+4
@@ -446,6 +446,10 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator implemen
|
||||
if (match && mappingInfo.methods.length == 0 && mappingInfo.params.length == 0 &&
|
||||
resolvedMethodName != null && !resolvedMethodName.equals(handlerMethod.getName())) {
|
||||
match = false;
|
||||
} else {
|
||||
for (RequestMethod requestMethod : mappingInfo.methods) {
|
||||
allowedMethods.add(requestMethod.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
|
||||
Reference in New Issue
Block a user