Skip to content

Commit

Permalink
feat: make builder use null graphQLContext if null was provided (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelAndalon authored Dec 6, 2022
1 parent a057368 commit a059442
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun GraphQLRequest.toExecutionInput(
.extensions(this.extensions ?: emptyMap())
.dataLoaderRegistry(dataLoaderRegistry ?: KotlinDataLoaderRegistry())
.also { builder ->
graphQLContext?.let { builder.context(it) }
builder.context(graphQLContext)
graphQLContextMap?.let { builder.graphQLContext(it) }
}
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.dataloader.DataLoader
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue

class RequestExtensionsKtTest {
Expand Down Expand Up @@ -80,6 +81,7 @@ class RequestExtensionsKtTest {

val executionInput = request.toExecutionInput(graphQLContextMap = context)
assertEquals(1, executionInput.graphQLContext.get("foo"))
assertNull(executionInput.context)
}

@Test
Expand Down

0 comments on commit a059442

Please sign in to comment.