Skip to content

Commit

Permalink
Pass Extras to NetworkClient
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroBrine1st committed Jan 8, 2025
1 parent 71287f0 commit ffeaac9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
9 changes: 5 additions & 4 deletions coil-network-core/api/android/coil-network-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ public final class coil3/network/NetworkHeaders$Companion {
}

public final class coil3/network/NetworkRequest {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest;
public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILjava/lang/Object;)Lcoil3/network/NetworkRequest;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)Lcoil3/network/NetworkRequest;
public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILjava/lang/Object;)Lcoil3/network/NetworkRequest;
public fun equals (Ljava/lang/Object;)Z
public final fun getBody ()Lcoil3/network/NetworkRequestBody;
public final fun getExtras ()Lcoil3/Extras;
public final fun getHeaders ()Lcoil3/network/NetworkHeaders;
public final fun getMethod ()Ljava/lang/String;
public final fun getUrl ()Ljava/lang/String;
Expand Down
6 changes: 4 additions & 2 deletions coil-network-core/api/coil-network-core.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,20 @@ final class coil3.network/NetworkHeaders { // coil3.network/NetworkHeaders|null[
}

final class coil3.network/NetworkRequest { // coil3.network/NetworkRequest|null[0]
constructor <init>(kotlin/String, kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ...) // coil3.network/NetworkRequest.<init>|<init>(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?){}[0]
constructor <init>(kotlin/String, kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ..., coil3/Extras) // coil3.network/NetworkRequest.<init>|<init>(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?;coil3.Extras){}[0]

final val body // coil3.network/NetworkRequest.body|{}body[0]
final fun <get-body>(): coil3.network/NetworkRequestBody? // coil3.network/NetworkRequest.body.<get-body>|<get-body>(){}[0]
final val extras // coil3.network/NetworkRequest.extras|{}extras[0]
final fun <get-extras>(): coil3/Extras // coil3.network/NetworkRequest.extras.<get-extras>|<get-extras>(){}[0]
final val headers // coil3.network/NetworkRequest.headers|{}headers[0]
final fun <get-headers>(): coil3.network/NetworkHeaders // coil3.network/NetworkRequest.headers.<get-headers>|<get-headers>(){}[0]
final val method // coil3.network/NetworkRequest.method|{}method[0]
final fun <get-method>(): kotlin/String // coil3.network/NetworkRequest.method.<get-method>|<get-method>(){}[0]
final val url // coil3.network/NetworkRequest.url|{}url[0]
final fun <get-url>(): kotlin/String // coil3.network/NetworkRequest.url.<get-url>|<get-url>(){}[0]

final fun copy(kotlin/String = ..., kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ...): coil3.network/NetworkRequest // coil3.network/NetworkRequest.copy|copy(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?){}[0]
final fun copy(kotlin/String = ..., kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ..., coil3/Extras = ...): coil3.network/NetworkRequest // coil3.network/NetworkRequest.copy|copy(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?;coil3.Extras){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // coil3.network/NetworkRequest.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // coil3.network/NetworkRequest.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // coil3.network/NetworkRequest.toString|toString(){}[0]
Expand Down
9 changes: 5 additions & 4 deletions coil-network-core/api/jvm/coil-network-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ public final class coil3/network/NetworkHeaders$Companion {
}

public final class coil3/network/NetworkRequest {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest;
public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILjava/lang/Object;)Lcoil3/network/NetworkRequest;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)Lcoil3/network/NetworkRequest;
public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILjava/lang/Object;)Lcoil3/network/NetworkRequest;
public fun equals (Ljava/lang/Object;)Z
public final fun getBody ()Lcoil3/network/NetworkRequestBody;
public final fun getExtras ()Lcoil3/Extras;
public final fun getHeaders ()Lcoil3/network/NetworkHeaders;
public final fun getMethod ()Ljava/lang/String;
public final fun getUrl ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package coil3.network

import coil3.Extras
import coil3.annotation.Poko
import coil3.network.internal.HTTP_METHOD_GET
import coil3.network.internal.HTTP_RESPONSE_OK
Expand Down Expand Up @@ -34,17 +35,20 @@ class NetworkRequest(
val method: String = HTTP_METHOD_GET,
val headers: NetworkHeaders = NetworkHeaders.EMPTY,
val body: NetworkRequestBody? = null,
val extras: Extras
) {
fun copy(
url: String = this.url,
method: String = this.method,
headers: NetworkHeaders = this.headers,
body: NetworkRequestBody? = this.body,
extras: Extras = this.extras
) = NetworkRequest(
url = url,
method = method,
headers = headers,
body = body,
extras = extras
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class NetworkFetcher(
method = options.httpMethod,
headers = headers.build(),
body = options.httpBody,
extras = options.extras
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class NetworkFetcherTest : RobolectricTest() {

assertIs<SourceFetchResult>(result)

val expected = NetworkRequest(url, method, headers, body)
val expected = NetworkRequest(url, method, headers, body, options.extras)

assertEquals(expected, networkClient.requests.single())
}
Expand Down

0 comments on commit ffeaac9

Please sign in to comment.