Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sdk-core/api/sdk-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down Expand Up @@ -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)) {
Expand Down
Loading