Skip to content

Commit

Permalink
Add test for #1220. See also #1221.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Aug 13, 2015
1 parent 6b2453e commit daca82d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions source/vibe/inet/webform.d
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,34 @@ unittest
assert(files["files"].filename == "file1.txt");
}

unittest
{
import vibe.stream.memory;

auto content_type = "multipart/form-data; boundary=\"AaB03x\"";

auto input = new MemoryStream(cast(ubyte[])
"--AaB03x\r\n"
"Content-Disposition: form-data; name=\"submit-name\"\r\n"
"Content-Length: 5"
"\r\n"
"Larry\r\n"
"--AaB03x\r\n"
"Content-Disposition: form-data; name=\"files\"; filename=\"file1.txt\"\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"... contents of file1.txt ...\r\n"
"--AaB03x--\r\n".dup, false);

FormFields fields;
FilePartFormFields files;

parseMultiPartForm(fields, files, content_type, input, 4096);

assert(fields["submit-name"] == "Larry");
assert(files["files"].filename == "file1.txt");
}

/**
Single part of a multipart form.
Expand Down

0 comments on commit daca82d

Please sign in to comment.