readBytes

suspend fun HttpResponse.readBytes(count: Int): ByteArray

Reads exactly count bytes of the HttpResponse.rawContent.


Deprecated

This method was renamed to readRawBytes() to reflect what it does.

Replace with

readRawBytes()

Reads the raw payload of the HTTP response as a byte array.

This method reads the raw payload of the HTTP response as a byte array. The raw payload is the content of the response that hasn't gone through any interceptors. The content will retain its original compression or encoding as received from the server.

If you need to read the content as decoded bytes, use the bodyAsBytes() method instead.

Return

the raw payload of the HTTP response as a byte array