ok2c commented on a change in pull request #191: Add 
org.apache.hc.core5.http.Method.normalizedValueOf(String) for use by
URL: 
https://github.com/apache/httpcomponents-core/pull/191#discussion_r371997533
 
 

 ##########
 File path: httpcore5/src/main/java/org/apache/hc/core5/http/Method.java
 ##########
 @@ -78,12 +79,22 @@ public static boolean isIdempotent(final String value) {
             return false;
         }
         try {
-            return valueOf(value.toUpperCase(Locale.ROOT)).idempotent;
+            return normalizedValueOf(value).idempotent;
         } catch (final IllegalArgumentException ex) {
             return false;
         }
     }
 
+    /**
+     * Returns the Method for a normalized {@code value} of a method name.
+     *
+     * @param method A method name like {@code "delete"}, {@code "DELETE"}, or 
any mixed-case variant.
+     * @return the Method for the given method name.
+     */
+    public static Method normalizedValueOf(final String method) {
+        return valueOf(Objects.requireNonNull(method, 
"method").toUpperCase(Locale.ROOT));
 
 Review comment:
   @garydgregory Please use `Args.notNull` for consistency with the rest of the 
code base.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to