diff --git a/examples/vweb/file_upload/index.html b/examples/vweb/file_upload/index.html index 1e79400594..e191d3962d 100644 --- a/examples/vweb/file_upload/index.html +++ b/examples/vweb/file_upload/index.html @@ -1,3 +1,11 @@ + + + + +Test multipart/form-data file uploading + + +

File Upload

File form: @@ -13,3 +21,6 @@ Text form: + + + diff --git a/vlib/net/http/request_test.v b/vlib/net/http/request_test.v index 81dd875d01..27abb35a23 100644 --- a/vlib/net/http/request_test.v +++ b/vlib/net/http/request_test.v @@ -103,16 +103,16 @@ fn test_parse_multipart_form() { file := 'bar.v' ct := 'application/octet-stream' contents := ['baz', 'buzz'] - data := "--------------------------$boundary -Content-Disposition: form-data; name=\"${names[0]}\"; filename=\"$file\" -Content-Type: $ct - -${contents[0]} ---------------------------$boundary -Content-Disposition: form-data; name=\"${names[1]}\" - -${contents[1]} ---------------------------$boundary-- + data := "--$boundary +Content-Disposition: form-data; name=\"${names[0]}\"; filename=\"$file\"\r +Content-Type: $ct\r +\r +${contents[0]}\r +--$boundary\r +Content-Disposition: form-data; name=\"${names[1]}\"\r +\r +${contents[1]}\r +--$boundary--\r " form, files := parse_multipart_form(data, boundary) assert files == {