Skip to content

Commit b76e0c4

Browse files
committed
HttpMethod#matches compares by String equality
Closes gh-26834
1 parent 55faf6e commit b76e0c4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spring-web/src/main/java/org/springframework/http/HttpMethod.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,14 +57,13 @@ public static HttpMethod resolve(@Nullable String method) {
5757

5858

5959
/**
60-
* Determine whether this {@code HttpMethod} matches the given
61-
* method value.
62-
* @param method the method value as a String
60+
* Determine whether this {@code HttpMethod} matches the given method value.
61+
* @param method the HTTP method as a String
6362
* @return {@code true} if it matches, {@code false} otherwise
6463
* @since 4.2.4
6564
*/
6665
public boolean matches(String method) {
67-
return (this == resolve(method));
66+
return name().equals(method);
6867
}
6968

7069
}

0 commit comments

Comments
 (0)