url
string or input range
content type
Response
rs = rq.exec!"POST"("http://httpbin.org/post", "привiт, свiт!", "application/octet-stream"); auto s = lineSplitter("one,\ntwo,\nthree."); rs = rq.exec!"POST"("http://httpbin.org/post", s, "application/octet-stream"); auto s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; rs = rq.exec!"POST"("http://httpbin.org/post", s.representation.chunks(10), "application/octet-stream"); auto f = File("tests/test.txt", "rb"); rs = rq.exec!"POST"("http://httpbin.org/post", f.byChunk(3), "application/octet-stream");
POST/PUT/... data from some string(with Content-Length), or from range of strings/bytes (use Transfer-Encoding: chunked). When rank 1 (flat array) used as content it must have length. In that case "content" will be sent directly to network, and Content-Length headers will be added. If you are goung to send some range and do not know length at the moment when you start to send request, then you can send chunks of chars or ubyte. Try not to send too short chunks as this will put additional load on client and server. Chunks of length 2048 or 4096 are ok.