What would be the equivalent of this curl statemen...
# ktor
l
What would be the equivalent of this curl statement in ktor?
Copy code
curl -X POST \
    $url \
    -H "Accept: application/json" \
    -H "Content-Type: application/octet-stream" \
    --data-binary "@$FILE"
i tried sending the file as body but I quickly ran out of memory with
setBody(file.readBytes()
. Is there a streaming implementation without using MultiPartForm?
a
Copy code
val client = HttpClient(Apache)

val response = <http://client.post|client.post>(url) {
    header(HttpHeaders.Accept, ContentType.Application.Json)
    contentType(ContentType.Application.OctetStream)
    setBody(FILE.readChannel())
}
👀 1