applyIf
Runs block on this receiver when condition is true and returns the receiver.
A conditional apply. The receiver is returned unchanged when condition is false.
val request = HttpRequestBuilder()
.applyIf(compress) { header("Content-Encoding", "gzip") }Content copied to clipboard
Return
the receiver, for chaining.
Parameters
condition
whether to run block.
block
configuration to apply to the receiver.