Skip to content

Commit

Permalink
Split request body channel on the client's scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Stexxe committed Dec 25, 2024
1 parent 8631e50 commit 4719f74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public val Logging: ClientPlugin<LoggingConfig> = createClientPlugin("Logging",
null
}
is OutgoingContent.ReadChannelContent -> {
val (origChannel, newChannel) = content.readFrom().split(GlobalScope)
val (origChannel, newChannel) = content.readFrom().split(client)
logRequestBody(content, content.contentLength, headers, method, newChannel)
LoggedContent(content, origChannel)
}
Expand All @@ -193,7 +193,7 @@ public val Logging: ClientPlugin<LoggingConfig> = createClientPlugin("Logging",
content.writeTo(channel)
channel.close()

val (origChannel, newChannel) = channel.split(GlobalScope)
val (origChannel, newChannel) = channel.split(client)
logRequestBody(content, content.contentLength, headers, method, newChannel)
LoggedContent(content, origChannel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,6 @@ class NewFormatTest {
.assertNoMoreLogs()
}

// TODO: Test cancellation while logging the request (GlobalScope splitting)
// TODO: Test consumption of request body

@Test
fun bodyPostBinaryReadChannel() = testWithLevel(LogLevel.BODY, handle = { respondWithLength() }) { client ->
client.post("/") {
Expand Down

0 comments on commit 4719f74

Please sign in to comment.