{"record":{"id":"bb862a92099e75ec","repo":"alibaba/nacos","slug":"unsupported-http-method-name","errorCode":null,"errorMessage":"Unsupported http method : {name}","messagePattern":"Unsupported http method : (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/alibaba/nacos/common/http/BaseHttpMethod.java","lineNumber":172,"sourceCode":"    }\n    \n    protected HttpUriRequestBase createRequest(String url) {\n        throw new UnsupportedOperationException();\n    }\n    \n    /**\n     * Value of {@link BaseHttpMethod}.\n     *\n     * @param name method name\n     * @return {@link BaseHttpMethod}\n     */\n    public static BaseHttpMethod sourceOf(String name) {\n        for (BaseHttpMethod method : BaseHttpMethod.values()) {\n            if (StringUtils.equalsIgnoreCase(name, method.name)) {\n                return method;\n            }\n        }\n        throw new IllegalArgumentException(\"Unsupported http method : \" + name);\n    }\n    \n    /**\n     * get Large implemented.\n     * <p>\n     * Mainly used for GET request parameters are relatively large, can not be placed on the URL, so it needs to be\n     * placed in the body.\n     * </p>\n     */\n    public static class HttpGetWithEntity extends HttpUriRequestBase {\n        \n        public static final String METHOD_NAME = \"GET\";\n        \n        public HttpGetWithEntity(String url) {\n            super(METHOD_NAME, URI.create(url));\n        }\n    }\n    ","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/common/src/main/java/com/alibaba/nacos/common/http/BaseHttpMethod.java#L154-L190","documentation":"Thrown by BaseHttpMethod.sourceOf() as an IllegalArgumentException when the provided method name does not match any of the supported HTTP methods (case-insensitive). Supported methods: GET, GET_LARGE, POST, PUT, DELETE, DELETE_LARGE, HEAD, TRACE, PATCH, OPTIONS. This is used internally by the Nacos HTTP client to map method name strings to enum values.","triggerScenarios":"Passing a method name like 'CONNECT', 'get_large' (wrong case handled but typo matters), or any non-standard HTTP verb to sourceOf(). A null input would cause a NullPointerException before reaching the throw.","commonSituations":"Custom HTTP interceptors or proxy layers injecting non-standard method names; typo in method configuration; outdated method names from older Nacos versions.","solutions":["Check the method name from the exception message and use one of the supported values: GET, POST, PUT, DELETE, HEAD, TRACE, PATCH, OPTIONS (or GET_LARGE / DELETE_LARGE for body-carrying variants).","If you need CONNECT or a custom method, it is not supported by this enum-based dispatch; use the underlying Apache HttpClient directly."],"exampleFix":"// before\nBaseHttpMethod method = BaseHttpMethod.sourceOf(\"CONNECT\");\n\n// after\nBaseHttpMethod method = BaseHttpMethod.sourceOf(\"POST\");","handlingStrategy":"validation","validationCode":"Set<String> validMethods = Set.of(\"GET\", \"GET_LARGE\", \"POST\", \"PUT\", \"DELETE\",\n    \"DELETE_LARGE\", \"HEAD\", \"TRACE\", \"PATCH\", \"OPTIONS\");\nif (!validMethods.contains(methodName.toUpperCase())) {\n    throw new IllegalArgumentException(\"Unsupported HTTP method: \" + methodName\n        + \". Supported: \" + validMethods);\n}","typeGuard":null,"tryCatchPattern":"try {\n    BaseHttpMethod method = BaseHttpMethod.sourceOf(name);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Unsupported http method\")) {\n        // Default to GET or reject the request\n        method = BaseHttpMethod.GET;\n    } else {\n        throw e;\n    }\n}","preventionTips":["Restrict HTTP method input to the supported set before calling sourceOf().","Validate method names at the API boundary before they reach the Nacos HTTP client.","Document the supported method names for consumers of your API."],"tags":["http-client","validation","http-method","enum"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}