Skip to content

Commit df82845

Browse files
authored
Clarify semantics of HttpMethod.valueOf()
HttpMethod.valueOf() performs a case-sensitive lookup of predefined HttpMethod constants. For example, valueOf("GET") resolves to HttpMethod.GET, whereas valueOf("get") results in a newly created HttpMethod instance. Update the Javadoc to explicitly document this behavior. See gh-36642 Closes gh-36652 Signed-off-by: angry-2k <edkev@kakao.com>
1 parent ff3f293 commit df82845

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public static HttpMethod[] values() {
110110

111111
/**
112112
* Return an {@code HttpMethod} object for the given value.
113+
* <p>Note that this lookup is case-sensitive. For predefined constants,
114+
* the method value must be provided in uppercase (e.g., {@code "GET"},
115+
* {@code "POST"}). If no predefined constant matches, a new
116+
* {@code HttpMethod} instance is returned for the given value as-is.
113117
* @param method the method value as a String
114118
* @return the corresponding {@code HttpMethod}
115119
*/

0 commit comments

Comments
 (0)