@@ -10,11 +10,10 @@ package org.dexpace.sdk.core.http.request
1010// Public API surface — not every HTTP method entry is referenced within this module; SDK consumers may use any.
1111
1212/* *
13- * HTTP request methods recognized by the SDK. Each constant carries the canonical token used
14- * on the wire; [ toString] returns that same token so the enum can be written directly into a
15- * request line without translation.
13+ * HTTP request methods recognized by the SDK. Each constant's name is the canonical token used
14+ * on the wire, so the enum's default ` toString()` returns that token and the constant can be
15+ * written directly into a request line without translation.
1616 *
17- * @property method Canonical uppercase method token sent in the request line.
1817 * @property permitsRequestBody Whether this SDK permits the method to carry a request body.
1918 * `false` for `GET`, `HEAD`, `TRACE`, and `CONNECT`. Of these only `TRACE` is forbidden a body
2019 * outright by HTTP — a TRACE request "MUST NOT send content" (RFC 9110 §9.3.8); for `GET`/`HEAD`
@@ -26,20 +25,25 @@ package org.dexpace.sdk.core.http.request
2625 * differently per transport.
2726 */
2827@Suppress(" unused" )
29- public enum class Method (
30- public val method : String ,
31- public val permitsRequestBody : Boolean ,
32- ) {
33- GET (" GET" , permitsRequestBody = false ),
34- POST (" POST" , permitsRequestBody = true ),
35- PUT (" PUT" , permitsRequestBody = true ),
36- DELETE (" DELETE" , permitsRequestBody = true ),
37- PATCH (" PATCH" , permitsRequestBody = true ),
38- HEAD (" HEAD" , permitsRequestBody = false ),
39- OPTIONS (" OPTIONS" , permitsRequestBody = true ),
40- TRACE (" TRACE" , permitsRequestBody = false ),
41- CONNECT (" CONNECT" , permitsRequestBody = false ),
28+ public enum class Method (public val permitsRequestBody : Boolean ) {
29+ GET (permitsRequestBody = false ),
30+ POST (permitsRequestBody = true ),
31+ PUT (permitsRequestBody = true ),
32+ DELETE (permitsRequestBody = true ),
33+ PATCH (permitsRequestBody = true ),
34+ HEAD (permitsRequestBody = false ),
35+ OPTIONS (permitsRequestBody = true ),
36+ TRACE (permitsRequestBody = false ),
37+ CONNECT (permitsRequestBody = false ),
4238 ;
4339
44- override fun toString (): String = method
40+ /* *
41+ * Canonical uppercase method token sent in the request line; identical to the enum [name].
42+ *
43+ * `MemberNameEqualsClassName` is suppressed: the accessor is retained for API compatibility
44+ * (`getMethod()`) and the token genuinely *is* the method's name, so renaming it would only
45+ * obscure that and break callers.
46+ */
47+ @Suppress(" MemberNameEqualsClassName" )
48+ public val method: String get() = name
4549}
0 commit comments