1
0
Fork 0
firefox/dom/fetch/tests/multipart.sjs
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

32 lines
1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function handleRequest(request, response) {
response.seizePower();
response.write("HTTP/1.1 200 OK\r\n");
response.write("Access-Control-Allow-Origin: *\r\n");
// See bug 1752761. The extra "\r\n" was the reason why FormDataParser
// could not parse this correctly.
response.write(
"Content-type: multipart/form-data; boundary=boundary\r\n\r\n"
);
response.write("\r\n");
response.write("--boundary\r\n");
response.write(
'Content-Disposition: form-data; name="file1"; filename="file1.txt"\r\n'
);
response.write("Content-Type: text/plain\r\n\r\n");
response.write("Content of file1\r\n");
response.write("--boundary\r\n");
response.write(
'Content-Disposition: form-data; name="file2"; filename="file2.txt"\r\n'
);
response.write("Content-Type: text/plain\r\n\r\n");
response.write("Content of file2\r\n");
response.write("--boundary--\r\n");
response.write("");
response.finish();
}