Fix regression in WebFlux support for WebDAV methods
This commit ensures that WebFlux's RequestMethodsRequestCondition supports HTTP methods that are not in the RequestMethod enum. - RequestMethod::resolve is introduced, to convert from a HttpMethod (name) to enum values. - RequestMethod::asHttpMethod is introduced, to convert from enum value to HttpMethod. - HttpMethod::valueOf replaced Map-based lookup to a switch statement - Enabled tests that check for WebDAV methods See gh-27697 Closes gh-29981
This commit is contained in:
@@ -157,9 +157,8 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
|
||||
@Nullable
|
||||
private RequestMethodsRequestCondition matchRequestMethod(String httpMethodValue) {
|
||||
RequestMethod requestMethod;
|
||||
try {
|
||||
requestMethod = RequestMethod.valueOf(httpMethodValue);
|
||||
RequestMethod requestMethod = RequestMethod.resolve(httpMethodValue);
|
||||
if (requestMethod != null) {
|
||||
if (getMethods().contains(requestMethod)) {
|
||||
return requestMethodConditionCache.get(httpMethodValue);
|
||||
}
|
||||
@@ -167,9 +166,6 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
return requestMethodConditionCache.get(HttpMethod.GET.name());
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// Custom request method
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user