11package org.jetbrains.kotlinx.jupyter.ktor.client.core
22
3- import io.ktor.client.call.*
4- import io.ktor.client.statement.*
5- import io.ktor.http.*
6- import io.ktor.util.*
7- import io.ktor.util.date.*
8- import io.ktor.util.reflect.*
9- import io.ktor.utils.io.*
3+ import io.ktor.client.call.DoubleReceiveException
4+ import io.ktor.client.call.HttpClientCall
5+ import io.ktor.client.call.NoTransformationFoundException
6+ import io.ktor.client.call.body
7+ import io.ktor.client.statement.HttpResponse
8+ import io.ktor.client.statement.bodyAsText
9+ import io.ktor.client.statement.content
10+ import io.ktor.client.statement.readBytes
11+ import io.ktor.client.statement.readRawBytes
12+ import io.ktor.http.Headers
13+ import io.ktor.http.HttpProtocolVersion
14+ import io.ktor.http.HttpStatusCode
15+ import io.ktor.util.date.GMTDate
16+ import io.ktor.util.reflect.TypeInfo
17+ import io.ktor.utils.io.ByteReadChannel
18+ import io.ktor.utils.io.InternalAPI
1019import kotlinx.coroutines.runBlocking
1120import java.nio.charset.Charset
1221import kotlin.coroutines.CoroutineContext
@@ -18,7 +27,7 @@ import kotlin.coroutines.CoroutineContext
1827public class NotebookHttpResponse (public val ktorResponse : HttpResponse ) : HttpResponse(){
1928override val call: HttpClientCall get() = ktorResponse.call
2029 @InternalAPI
21- override val content : ByteReadChannel get() = ktorResponse.content
30+ override val rawContent : ByteReadChannel get() = ktorResponse.rawContent
2231override val coroutineContext: CoroutineContext get() = ktorResponse.coroutineContext
2332override val headers: Headers get() = ktorResponse.headers
2433override val requestTime: GMTDate get() = ktorResponse.requestTime
@@ -58,7 +67,14 @@ public class NotebookHttpResponse(public val ktorResponse: HttpResponse) : HttpR
5867 * Reads the whole [HttpResponse.content] if `Content-Length` is specified.
5968 * Otherwise, it just reads one byte.
6069*/
61- public fun readBytes (): ByteArray = runBlocking{ktorResponse.readBytes() }
70+ @Deprecated(" Use readRawBytes() instead" , ReplaceWith (" readRawBytes()" ))
71+ public fun readBytes (): ByteArray = readRawBytes()
72+
73+ /* *
74+ * Reads the whole [HttpResponse.content] if `Content-Length` is specified.
75+ * Otherwise, it just reads one byte.
76+ */
77+ public fun readRawBytes (): ByteArray = runBlocking{ktorResponse.readRawBytes() }
6278
6379/* *
6480 * Reads exactly [count] bytes of the [HttpResponse.content].
0 commit comments