Skip to content

Commit db26c59

Browse files
martinbonninBoD
authored andcommitted
Add cacheInterceptor() and autoPersistedQueriesInterceptor() (#6455)
* Add cacheInterceptor() and autoPersistedQueriesInterceptor() * make cacheInterceptor public * add mention in the changelog * remove obsolete tests * update the test to include patching based on the response * update README (cherry picked from commit 1a9918a)
1 parent 716b7dc commit db26c59

File tree

10 files changed

+141
-97
lines changed

10 files changed

+141
-97
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Change Log
44
# Next version
55

66
* Downloading or converting a SDL schema from introspection now includes scalar definitions. This is required for clients to get a [full view of the schema](https://github.com/graphql/graphql-wg/blob/main/rfcs/FullSchemas.md).
7+
* The cache and auto persisted queries interceptors are now always added after all users interceptor. If you relied on some interceptors being called **after** `normalizedCache()` or `persistedQueries()`, you might have to update your code. One example is if you need to change cache flags based on the GraphQL response. In those cases, we recommend you use a custom `NetworkTransport` instead (See [this commit](https://github.com/apollographql/apollo-kotlin/pull/6455/commits/a53a44e5e506af7b0f6f495eed1a9d477e18bf73) for an example).
78

89
# Version 4.1.1
910

libraries/apollo-normalized-cache/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/ClientCacheExtensions.kt

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,54 @@ fun ApolloClient.Builder.normalizedCache(
113113
fun ApolloClient.Builder.logCacheMisses(
114114
log: (String) -> Unit = { println(it) },
115115
): ApolloClient.Builder {
116-
check(interceptors.none { it is ApolloCacheInterceptor }) {
117-
"Apollo: logCacheMisses() must be called before setting up your normalized cache"
118-
}
119116
return addInterceptor(CacheMissLoggingInterceptor(log))
120117
}
121118

122-
fun ApolloClient.Builder.store(store: ApolloStore, writeToCacheAsynchronously: Boolean = false): ApolloClient.Builder {
123-
check(interceptors.none { it is AutoPersistedQueryInterceptor }) {
124-
"Apollo: the normalized cache must be configured before the auto persisted queries"
119+
private class DefaultInterceptorChain(
120+
private val interceptors: List<ApolloInterceptor>,
121+
private val index: Int,
122+
) : ApolloInterceptorChain {
123+
124+
override fun <D : Operation.Data> proceed(request: ApolloRequest<D>): Flow<ApolloResponse<D>> {
125+
check(index < interceptors.size)
126+
return interceptors[index].intercept(
127+
request,
128+
DefaultInterceptorChain(
129+
interceptors = interceptors,
130+
index = index + 1,
131+
)
132+
)
133+
}
134+
}
135+
136+
private fun ApolloInterceptorChain.asInterceptor(): ApolloInterceptor {
137+
return object : ApolloInterceptor {
138+
override fun <D : Operation.Data> intercept(
139+
request: ApolloRequest<D>,
140+
chain: ApolloInterceptorChain,
141+
): Flow<ApolloResponse<D>> {
142+
return this@asInterceptor.proceed(request)
143+
}
125144
}
126-
// Removing existing interceptors added for configuring an [ApolloStore].
127-
// If a builder is reused from an existing client using `newBuilder()` and we try to configure a new `store()` on it, we first need to
128-
// remove the old interceptors.
129-
val storeInterceptors = interceptors.filterIsInstance<ApolloStoreInterceptor>()
130-
storeInterceptors.forEach {
131-
removeInterceptor(it)
145+
}
146+
internal class CacheInterceptor(val store: ApolloStore): ApolloInterceptor {
147+
private val delegates = listOf(
148+
WatcherInterceptor(store),
149+
FetchPolicyRouterInterceptor,
150+
ApolloCacheInterceptor(store)
151+
)
152+
153+
override fun <D : Operation.Data> intercept(
154+
request: ApolloRequest<D>,
155+
chain: ApolloInterceptorChain,
156+
): Flow<ApolloResponse<D>> {
157+
return DefaultInterceptorChain(delegates + chain.asInterceptor(), 0).proceed(request)
132158
}
133-
return addInterceptor(WatcherInterceptor(store))
134-
.addInterceptor(FetchPolicyRouterInterceptor)
135-
.addInterceptor(ApolloCacheInterceptor(store))
159+
}
160+
161+
162+
fun ApolloClient.Builder.store(store: ApolloStore, writeToCacheAsynchronously: Boolean = false): ApolloClient.Builder {
163+
return cacheInterceptor(CacheInterceptor(store))
136164
.writeToCacheAsynchronously(writeToCacheAsynchronously)
137165
.addExecutionContext(CacheDumpProviderContext(store.cacheDumpProvider()))
138166
}
@@ -228,9 +256,7 @@ internal fun <D : Query.Data> ApolloCall<D>.watchInternal(data: D?): Flow<Apollo
228256

229257
val ApolloClient.apolloStore: ApolloStore
230258
get() {
231-
return interceptors.firstOrNull { it is ApolloCacheInterceptor }?.let {
232-
(it as ApolloCacheInterceptor).store
233-
} ?: error("no cache configured")
259+
return (cacheInterceptor as? CacheInterceptor ?: error("no cache configured")).store
234260
}
235261

236262
/**

libraries/apollo-runtime/api/android/apollo-runtime.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public final class com/apollographql/apollo/ApolloClient : com/apollographql/apo
4343
public fun close ()V
4444
public final fun dispose ()V
4545
public final fun executeAsFlow (Lcom/apollographql/apollo/api/ApolloRequest;)Lkotlinx/coroutines/flow/Flow;
46+
public final fun getCacheInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
4647
public fun getCanBeBatched ()Ljava/lang/Boolean;
4748
public final fun getCustomScalarAdapters ()Lcom/apollographql/apollo/api/CustomScalarAdapters;
4849
public fun getEnableAutoPersistedQueries ()Ljava/lang/Boolean;
@@ -76,7 +77,9 @@ public final class com/apollographql/apollo/ApolloClient$Builder : com/apollogra
7677
public final fun autoPersistedQueries (Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;)Lcom/apollographql/apollo/ApolloClient$Builder;
7778
public final fun autoPersistedQueries (Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;Z)Lcom/apollographql/apollo/ApolloClient$Builder;
7879
public static synthetic fun autoPersistedQueries$default (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;ZILjava/lang/Object;)Lcom/apollographql/apollo/ApolloClient$Builder;
80+
public final fun autoPersistedQueriesInterceptor (Lcom/apollographql/apollo/interceptor/ApolloInterceptor;)Lcom/apollographql/apollo/ApolloClient$Builder;
7981
public final fun build ()Lcom/apollographql/apollo/ApolloClient;
82+
public final fun cacheInterceptor (Lcom/apollographql/apollo/interceptor/ApolloInterceptor;)Lcom/apollographql/apollo/ApolloClient$Builder;
8083
public fun canBeBatched (Ljava/lang/Boolean;)Lcom/apollographql/apollo/ApolloClient$Builder;
8184
public synthetic fun canBeBatched (Ljava/lang/Boolean;)Ljava/lang/Object;
8285
public final fun copy ()Lcom/apollographql/apollo/ApolloClient$Builder;
@@ -86,6 +89,8 @@ public final class com/apollographql/apollo/ApolloClient$Builder : com/apollogra
8689
public synthetic fun enableAutoPersistedQueries (Ljava/lang/Boolean;)Ljava/lang/Object;
8790
public final fun executionContext (Lcom/apollographql/apollo/api/ExecutionContext;)Lcom/apollographql/apollo/ApolloClient$Builder;
8891
public final fun failFastIfOffline (Ljava/lang/Boolean;)Lcom/apollographql/apollo/ApolloClient$Builder;
92+
public final fun getAutoPersistedQueryInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
93+
public final fun getCacheInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
8994
public fun getCanBeBatched ()Ljava/lang/Boolean;
9095
public final fun getCustomScalarAdapters ()Lcom/apollographql/apollo/api/CustomScalarAdapters;
9196
public final fun getDispatcher ()Lkotlinx/coroutines/CoroutineDispatcher;

libraries/apollo-runtime/api/apollo-runtime.klib.api

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ final class com.apollographql.apollo.network.ws/WebSocketNetworkTransport : com.
586586
}
587587

588588
final class com.apollographql.apollo/ApolloClient : com.apollographql.apollo.api/ExecutionOptions, okio/Closeable { // com.apollographql.apollo/ApolloClient|null[0]
589+
final val cacheInterceptor // com.apollographql.apollo/ApolloClient.cacheInterceptor|{}cacheInterceptor[0]
590+
final fun <get-cacheInterceptor>(): com.apollographql.apollo.interceptor/ApolloInterceptor? // com.apollographql.apollo/ApolloClient.cacheInterceptor.<get-cacheInterceptor>|<get-cacheInterceptor>(){}[0]
589591
final val canBeBatched // com.apollographql.apollo/ApolloClient.canBeBatched|{}canBeBatched[0]
590592
final fun <get-canBeBatched>(): kotlin/Boolean? // com.apollographql.apollo/ApolloClient.canBeBatched.<get-canBeBatched>|<get-canBeBatched>(){}[0]
591593
final val customScalarAdapters // com.apollographql.apollo/ApolloClient.customScalarAdapters|{}customScalarAdapters[0]
@@ -627,6 +629,10 @@ final class com.apollographql.apollo/ApolloClient : com.apollographql.apollo.api
627629
final val interceptors // com.apollographql.apollo/ApolloClient.Builder.interceptors|{}interceptors[0]
628630
final fun <get-interceptors>(): kotlin.collections/List<com.apollographql.apollo.interceptor/ApolloInterceptor> // com.apollographql.apollo/ApolloClient.Builder.interceptors.<get-interceptors>|<get-interceptors>(){}[0]
629631

632+
final var autoPersistedQueryInterceptor // com.apollographql.apollo/ApolloClient.Builder.autoPersistedQueryInterceptor|{}autoPersistedQueryInterceptor[0]
633+
final fun <get-autoPersistedQueryInterceptor>(): com.apollographql.apollo.interceptor/ApolloInterceptor? // com.apollographql.apollo/ApolloClient.Builder.autoPersistedQueryInterceptor.<get-autoPersistedQueryInterceptor>|<get-autoPersistedQueryInterceptor>(){}[0]
634+
final var cacheInterceptor // com.apollographql.apollo/ApolloClient.Builder.cacheInterceptor|{}cacheInterceptor[0]
635+
final fun <get-cacheInterceptor>(): com.apollographql.apollo.interceptor/ApolloInterceptor? // com.apollographql.apollo/ApolloClient.Builder.cacheInterceptor.<get-cacheInterceptor>|<get-cacheInterceptor>(){}[0]
630636
final var canBeBatched // com.apollographql.apollo/ApolloClient.Builder.canBeBatched|{}canBeBatched[0]
631637
final fun <get-canBeBatched>(): kotlin/Boolean? // com.apollographql.apollo/ApolloClient.Builder.canBeBatched.<get-canBeBatched>|<get-canBeBatched>(){}[0]
632638
final var dispatcher // com.apollographql.apollo/ApolloClient.Builder.dispatcher|{}dispatcher[0]
@@ -680,7 +686,9 @@ final class com.apollographql.apollo/ApolloClient : com.apollographql.apollo.api
680686
final fun addInterceptors(kotlin.collections/List<com.apollographql.apollo.interceptor/ApolloInterceptor>): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.addInterceptors|addInterceptors(kotlin.collections.List<com.apollographql.apollo.interceptor.ApolloInterceptor>){}[0]
681687
final fun addListener(com.apollographql.apollo.internal/ApolloClientListener): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.addListener|addListener(com.apollographql.apollo.internal.ApolloClientListener){}[0]
682688
final fun autoPersistedQueries(com.apollographql.apollo.api.http/HttpMethod = ..., com.apollographql.apollo.api.http/HttpMethod = ..., kotlin/Boolean = ...): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.autoPersistedQueries|autoPersistedQueries(com.apollographql.apollo.api.http.HttpMethod;com.apollographql.apollo.api.http.HttpMethod;kotlin.Boolean){}[0]
689+
final fun autoPersistedQueriesInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor?): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.autoPersistedQueriesInterceptor|autoPersistedQueriesInterceptor(com.apollographql.apollo.interceptor.ApolloInterceptor?){}[0]
683690
final fun build(): com.apollographql.apollo/ApolloClient // com.apollographql.apollo/ApolloClient.Builder.build|build(){}[0]
691+
final fun cacheInterceptor(com.apollographql.apollo.interceptor/ApolloInterceptor?): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.cacheInterceptor|cacheInterceptor(com.apollographql.apollo.interceptor.ApolloInterceptor?){}[0]
684692
final fun canBeBatched(kotlin/Boolean?): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.canBeBatched|canBeBatched(kotlin.Boolean?){}[0]
685693
final fun copy(): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.copy|copy(){}[0]
686694
final fun customScalarAdapters(com.apollographql.apollo.api/CustomScalarAdapters): com.apollographql.apollo/ApolloClient.Builder // com.apollographql.apollo/ApolloClient.Builder.customScalarAdapters|customScalarAdapters(com.apollographql.apollo.api.CustomScalarAdapters){}[0]

libraries/apollo-runtime/api/jvm/apollo-runtime.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public final class com/apollographql/apollo/ApolloClient : com/apollographql/apo
4343
public fun close ()V
4444
public final fun dispose ()V
4545
public final fun executeAsFlow (Lcom/apollographql/apollo/api/ApolloRequest;)Lkotlinx/coroutines/flow/Flow;
46+
public final fun getCacheInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
4647
public fun getCanBeBatched ()Ljava/lang/Boolean;
4748
public final fun getCustomScalarAdapters ()Lcom/apollographql/apollo/api/CustomScalarAdapters;
4849
public fun getEnableAutoPersistedQueries ()Ljava/lang/Boolean;
@@ -76,7 +77,9 @@ public final class com/apollographql/apollo/ApolloClient$Builder : com/apollogra
7677
public final fun autoPersistedQueries (Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;)Lcom/apollographql/apollo/ApolloClient$Builder;
7778
public final fun autoPersistedQueries (Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;Z)Lcom/apollographql/apollo/ApolloClient$Builder;
7879
public static synthetic fun autoPersistedQueries$default (Lcom/apollographql/apollo/ApolloClient$Builder;Lcom/apollographql/apollo/api/http/HttpMethod;Lcom/apollographql/apollo/api/http/HttpMethod;ZILjava/lang/Object;)Lcom/apollographql/apollo/ApolloClient$Builder;
80+
public final fun autoPersistedQueriesInterceptor (Lcom/apollographql/apollo/interceptor/ApolloInterceptor;)Lcom/apollographql/apollo/ApolloClient$Builder;
7981
public final fun build ()Lcom/apollographql/apollo/ApolloClient;
82+
public final fun cacheInterceptor (Lcom/apollographql/apollo/interceptor/ApolloInterceptor;)Lcom/apollographql/apollo/ApolloClient$Builder;
8083
public fun canBeBatched (Ljava/lang/Boolean;)Lcom/apollographql/apollo/ApolloClient$Builder;
8184
public synthetic fun canBeBatched (Ljava/lang/Boolean;)Ljava/lang/Object;
8285
public final fun copy ()Lcom/apollographql/apollo/ApolloClient$Builder;
@@ -86,6 +89,8 @@ public final class com/apollographql/apollo/ApolloClient$Builder : com/apollogra
8689
public synthetic fun enableAutoPersistedQueries (Ljava/lang/Boolean;)Ljava/lang/Object;
8790
public final fun executionContext (Lcom/apollographql/apollo/api/ExecutionContext;)Lcom/apollographql/apollo/ApolloClient$Builder;
8891
public final fun failFastIfOffline (Ljava/lang/Boolean;)Lcom/apollographql/apollo/ApolloClient$Builder;
92+
public final fun getAutoPersistedQueryInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
93+
public final fun getCacheInterceptor ()Lcom/apollographql/apollo/interceptor/ApolloInterceptor;
8994
public fun getCanBeBatched ()Ljava/lang/Boolean;
9095
public final fun getCustomScalarAdapters ()Lcom/apollographql/apollo/api/CustomScalarAdapters;
9196
public final fun getDispatcher ()Lkotlinx/coroutines/CoroutineDispatcher;

libraries/apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo/ApolloClient.kt

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ private constructor(
8282
val subscriptionNetworkTransport: NetworkTransport
8383
val interceptors: List<ApolloInterceptor> = builder.interceptors
8484
val customScalarAdapters: CustomScalarAdapters = builder.customScalarAdapters
85+
val cacheInterceptor: ApolloInterceptor? = builder.cacheInterceptor
86+
private val autoPersistedQueryInterceptor: ApolloInterceptor? = builder.autoPersistedQueryInterceptor
8587
private val retryOnError: ((ApolloRequest<*>) -> Boolean)? = builder.retryOnError
8688
private val retryOnErrorInterceptor: ApolloInterceptor? = builder.retryOnErrorInterceptor
8789
private val failFastIfOffline = builder.failFastIfOffline
@@ -315,6 +317,12 @@ private constructor(
315317

316318
val allInterceptors = buildList {
317319
addAll(interceptors)
320+
if (cacheInterceptor != null) {
321+
add(cacheInterceptor)
322+
}
323+
if (autoPersistedQueryInterceptor != null) {
324+
add(autoPersistedQueryInterceptor)
325+
}
318326
add(retryOnErrorInterceptor ?: RetryOnErrorInterceptor())
319327
add(networkInterceptor)
320328
}
@@ -407,6 +415,12 @@ private constructor(
407415
var failFastIfOffline: Boolean? = null
408416
private set
409417

418+
var cacheInterceptor: ApolloInterceptor? = null
419+
private set
420+
421+
var autoPersistedQueryInterceptor: ApolloInterceptor? = null
422+
private set
423+
410424
/**
411425
* Whether to fail fast if the device is offline.
412426
* Requires setting an interceptor that is aware of the network state with [retryOnErrorInterceptor].
@@ -466,6 +480,24 @@ private constructor(
466480
this.retryOnErrorInterceptor = retryOnErrorInterceptor
467481
}
468482

483+
/**
484+
* Sets the [ApolloInterceptor] used for caching.
485+
*
486+
* @see addInterceptor
487+
*/
488+
fun cacheInterceptor(cacheInterceptor: ApolloInterceptor?) = apply {
489+
this.cacheInterceptor = cacheInterceptor
490+
}
491+
492+
/**
493+
* Sets the [ApolloInterceptor] used for auto persisted queries.
494+
*
495+
* @see addInterceptor
496+
*/
497+
fun autoPersistedQueriesInterceptor(autoPersistedQueryInterceptor: ApolloInterceptor?) = apply {
498+
this.autoPersistedQueryInterceptor = autoPersistedQueryInterceptor
499+
}
500+
469501
/**
470502
* Configures the [HttpMethod] to use.
471503
*
@@ -791,8 +823,18 @@ private constructor(
791823
* such as normalized cache and auto persisted queries. [ApolloClient] also inserts a terminating [ApolloInterceptor] that
792824
* executes the request.
793825
*
794-
* **The order is important**. The [ApolloInterceptor]s are executed in the order they are added. Because cache and APQs also
795-
* use interceptors, the order of the cache/APQs configuration also influences the final interceptor list.
826+
* **The order is important**. The [ApolloInterceptor]s are added in the order they are added and always added before
827+
* the built-in intercepted:
828+
*
829+
* - user interceptors
830+
* - cacheInterceptor
831+
* - autoPersistedQueriesInterceptor
832+
* - retryOnErrorInterceptor
833+
* - networkInterceptor
834+
*
835+
* @see cacheInterceptor
836+
* @see autoPersistedQueriesInterceptor
837+
* @see retryOnErrorInterceptor
796838
*/
797839
fun addInterceptor(interceptor: ApolloInterceptor) = apply {
798840
_interceptors.add(interceptor)
@@ -878,8 +920,7 @@ private constructor(
878920
httpMethodForDocumentQueries: HttpMethod = HttpMethod.Post,
879921
enableByDefault: Boolean = true,
880922
) = apply {
881-
_interceptors.removeAll { it is AutoPersistedQueryInterceptor }
882-
addInterceptor(
923+
autoPersistedQueriesInterceptor(
883924
AutoPersistedQueryInterceptor(
884925
httpMethodForHashedQueries,
885926
httpMethodForDocumentQueries
@@ -915,9 +956,9 @@ private constructor(
915956
* Creates an [ApolloClient] from this [Builder]
916957
*/
917958
fun build(): ApolloClient {
918-
return ApolloClient(
919-
this.copy()
920-
)
959+
// Copy the builder so that any subsequent modifications of the builder
960+
// doesn't change the ApolloClient owned one
961+
return ApolloClient(copy())
921962
}
922963

923964
fun copy(): Builder {
@@ -946,6 +987,8 @@ private constructor(
946987
.wsProtocol(wsProtocolFactory)
947988
.retryOnError(retryOnError)
948989
.retryOnErrorInterceptor(retryOnErrorInterceptor)
990+
.cacheInterceptor(cacheInterceptor)
991+
.autoPersistedQueriesInterceptor(autoPersistedQueryInterceptor)
949992
.failFastIfOffline(failFastIfOffline)
950993
.listeners(listeners)
951994
}

tests/http-headers/src/test/kotlin/HttpHeaderTest.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import com.apollographql.apollo.ApolloClient
32
import com.apollographql.apollo.api.DefaultUpload
43
import com.apollographql.apollo.api.Optional
@@ -28,7 +27,7 @@ class HttpHeadersTest {
2827
@Test
2928
fun getRequestsSendPreflightHeader() = mockServerTest(
3029
clientBuilder = { autoPersistedQueries() }
31-
){
30+
) {
3231

3332
mockServer.enqueueString("")
3433
apolloClient.query(GetRandomQuery()).enableAutoPersistedQueries(true).execute()
@@ -63,14 +62,14 @@ class MockServerTest(val mockServer: MockServer, val apolloClient: ApolloClient,
6362

6463
fun mockServerTest(
6564
clientBuilder: ApolloClient.Builder.() -> Unit = {},
66-
block: suspend MockServerTest.() -> Unit
65+
block: suspend MockServerTest.() -> Unit,
6766
) = runTest {
6867
MockServer().use { mockServer ->
6968
ApolloClient.Builder()
7069
.serverUrl(mockServer.url())
7170
.apply(clientBuilder)
7271
.build()
73-
.use {apolloClient ->
72+
.use { apolloClient ->
7473
MockServerTest(mockServer, apolloClient, this).block()
7574
}
7675
}

0 commit comments

Comments
 (0)