write

fun write(chunk: String, encoding: String = definedExternally, callback: () -> Unit = definedExternally)(source)
fun write(chunk: Buffer, encoding: String = definedExternally, callback: () -> Unit = definedExternally)(source)

callback is essentially a dummy function introduced in the purpose of keeping similarity with the Node.js API. It is called asynchronously in the next tick after chunk content have been delivered to the Chromium networking layer. Contrary to the Node.js implementation, it is not guaranteed that chunk content have been flushed on the wire before callback is called.

Adds a chunk of data to the request body. The first write operation may cause the request headers to be issued on the wire. After the first write operation, it is not allowed to add or remove a custom header.