respondBytes

suspend fun ApplicationCall.respondBytes(
    contentType: ContentType? = null,
    status: HttpStatusCode? = null,
    provider: suspend () -> ByteArray
): Unit

Responds to a client with a raw bytes response, using specified provider to build a byte array

Parameters

contentType - is an optional ContentType, unspecified by default

status - is an optional HttpStatusCode, default is HttpStatusCode.OK

suspend fun ApplicationCall.respondBytes(
    bytes: ByteArray,
    contentType: ContentType? = null,
    status: HttpStatusCode? = null,
    configure: OutgoingContent.() -> Unit = {}
): Unit

Responds to a client with a raw bytes response, using specified bytes

Parameters

contentType - is an optional ContentType, unspecified by default

status - is an optional HttpStatusCode, default is HttpStatusCode.OK