diff --git a/sdk-core/api/sdk-core.api b/sdk-core/api/sdk-core.api index f551a3f..3055cb4 100644 --- a/sdk-core/api/sdk-core.api +++ b/sdk-core/api/sdk-core.api @@ -1048,7 +1048,6 @@ public final class org/dexpace/sdk/core/http/request/FileRequestBody : org/dexpa public fun isReplayable ()Z public fun mediaType ()Lorg/dexpace/sdk/core/http/common/MediaType; public final fun toByteBuffer ()Ljava/nio/ByteBuffer; - public fun toReplayable (Lorg/dexpace/sdk/core/io/IoProvider;)Lorg/dexpace/sdk/core/http/request/RequestBody; public fun writeTo (Lorg/dexpace/sdk/core/io/BufferedSink;)V } @@ -1078,7 +1077,6 @@ public final class org/dexpace/sdk/core/http/request/Method : java/lang/Enum { public static fun getEntries ()Lkotlin/enums/EnumEntries; public final fun getMethod ()Ljava/lang/String; public final fun getPermitsRequestBody ()Z - public fun toString ()Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Lorg/dexpace/sdk/core/http/request/Method; public static fun values ()[Lorg/dexpace/sdk/core/http/request/Method; } diff --git a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/FileRequestBody.kt b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/FileRequestBody.kt index e8727d7..7fa468b 100644 --- a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/FileRequestBody.kt +++ b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/FileRequestBody.kt @@ -9,7 +9,6 @@ package org.dexpace.sdk.core.http.request import org.dexpace.sdk.core.http.common.MediaType import org.dexpace.sdk.core.io.BufferedSink -import org.dexpace.sdk.core.io.IoProvider import java.io.IOException import java.nio.ByteBuffer import java.nio.channels.Channels @@ -100,8 +99,6 @@ public class FileRequestBody override fun isReplayable(): Boolean = true - override fun toReplayable(provider: IoProvider): RequestBody = this - @Throws(IOException::class) override fun writeTo(sink: BufferedSink) { FileChannel.open(file, StandardOpenOption.READ).use { channel -> diff --git a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/Method.kt b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/Method.kt index 107bff4..8120e4b 100644 --- a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/Method.kt +++ b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/Method.kt @@ -10,11 +10,10 @@ package org.dexpace.sdk.core.http.request // Public API surface — not every HTTP method entry is referenced within this module; SDK consumers may use any. /** - * HTTP request methods recognized by the SDK. Each constant carries the canonical token used - * on the wire; [toString] returns that same token so the enum can be written directly into a - * request line without translation. + * HTTP request methods recognized by the SDK. Each constant's name is the canonical token used + * on the wire, so the enum's default `toString()` returns that token and the constant can be + * written directly into a request line without translation. * - * @property method Canonical uppercase method token sent in the request line. * @property permitsRequestBody Whether this SDK permits the method to carry a request body. * `false` for `GET`, `HEAD`, `TRACE`, and `CONNECT`. Of these only `TRACE` is forbidden a body * 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 * differently per transport. */ @Suppress("unused") -public enum class Method( - public val method: String, - public val permitsRequestBody: Boolean, -) { - GET("GET", permitsRequestBody = false), - POST("POST", permitsRequestBody = true), - PUT("PUT", permitsRequestBody = true), - DELETE("DELETE", permitsRequestBody = true), - PATCH("PATCH", permitsRequestBody = true), - HEAD("HEAD", permitsRequestBody = false), - OPTIONS("OPTIONS", permitsRequestBody = true), - TRACE("TRACE", permitsRequestBody = false), - CONNECT("CONNECT", permitsRequestBody = false), +public enum class Method(public val permitsRequestBody: Boolean) { + GET(permitsRequestBody = false), + POST(permitsRequestBody = true), + PUT(permitsRequestBody = true), + DELETE(permitsRequestBody = true), + PATCH(permitsRequestBody = true), + HEAD(permitsRequestBody = false), + OPTIONS(permitsRequestBody = true), + TRACE(permitsRequestBody = false), + CONNECT(permitsRequestBody = false), ; - override fun toString(): String = method + /** + * Canonical uppercase method token sent in the request line; identical to the enum [name]. + * + * `MemberNameEqualsClassName` is suppressed: the accessor is retained for API compatibility + * (`getMethod()`) and the token genuinely *is* the method's name, so renaming it would only + * obscure that and break callers. + */ + @Suppress("MemberNameEqualsClassName") + public val method: String get() = name } diff --git a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/RequestBody.kt b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/RequestBody.kt index 1ed01ac..864d7f2 100644 --- a/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/RequestBody.kt +++ b/sdk-core/src/main/kotlin/org/dexpace/sdk/core/http/request/RequestBody.kt @@ -225,8 +225,6 @@ private class BufferRequestBody( override fun isReplayable(): Boolean = true - override fun toReplayable(provider: IoProvider): RequestBody = this - @Throws(IOException::class) override fun writeTo(sink: BufferedSink) { sink.writeAll(buffer.peek()) @@ -244,8 +242,6 @@ private class ByteArrayRequestBody( override fun isReplayable(): Boolean = true - override fun toReplayable(provider: IoProvider): RequestBody = this - @Throws(IOException::class) override fun writeTo(sink: BufferedSink) { sink.write(bytes) @@ -274,8 +270,6 @@ private class ResettableInputStreamRequestBody( override fun isReplayable(): Boolean = true - override fun toReplayable(provider: IoProvider): RequestBody = this - @Throws(IOException::class) override fun writeTo(sink: BufferedSink) { if (hasWritten.getAndSet(true)) {