|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "web" for Request
|
|
|
|
var body = "------FormBoundary\r\n" +
|
|
"Content-Disposition: form-data; name=\"username\"\r\n" +
|
|
"\r\n" +
|
|
"john\r\n" +
|
|
"------FormBoundary\r\n" +
|
|
"Content-Disposition: form-data; name=\"email\"\r\n" +
|
|
"\r\n" +
|
|
"john@example.com\r\n" +
|
|
"------FormBoundary--\r\n"
|
|
|
|
var headers = {
|
|
"Content-Type": "multipart/form-data; boundary=----FormBoundary"
|
|
}
|
|
|
|
var request = Request.new_("POST", "/submit", {}, headers, body, {}, null)
|
|
var form = request.form
|
|
|
|
System.print(form["username"]) // expect: john
|
|
System.print(form["email"]) // expect: john@example.com
|
|
System.print(form["file"]) // expect: null
|