|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "web" for Request
|
|
|
|
var content = ""
|
|
for (i in 0...1000) {
|
|
content = content + "ABCDEFGHIJ"
|
|
}
|
|
|
|
var body = "------boundary\r\n" +
|
|
"Content-Disposition: form-data; name=\"file\"; filename=\"large.bin\"\r\n" +
|
|
"Content-Type: application/octet-stream\r\n" +
|
|
"\r\n" +
|
|
content + "\r\n" +
|
|
"------boundary--\r\n"
|
|
|
|
var headers = {"Content-Type": "multipart/form-data; boundary=----boundary"}
|
|
var request = Request.new_("POST", "/upload", {}, headers, body, {}, null)
|
|
var form = request.form
|
|
|
|
System.print(form["file"]["filename"]) // expect: large.bin
|
|
System.print(form["file"]["content"].count) // expect: 10000
|