map

fun <T, R> HttpResponse.BodyHandler<T>.map(f: (T) -> R): HttpResponse.BodyHandler<R>

This function allows to create a new BodyHandler by transforming the output of the current BodyHandler.

Return

A new BodyHandler that applies the transformation function to the output of the current BodyHandler.

Example usage:

val ofInt: BodyHandler<Int> = ofString.map { it.toInt() }

Parameters

f

The function to transform the output of the current BodyHandler.