Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /fetch/content-type/multipart-malformed.any.html - WPT Dashboard Interop Dashboard
- /fetch/content-type/multipart-malformed.any.worker.html - WPT Dashboard Interop Dashboard
promise_test(t => {
const form_string =
"--Boundary_with_capital_letters\r\n" +
"Content-Type: application/json\r\n" +
'Content-Disposition: form-data; name="does_this_work"\r\n' +
"\r\n" +
'YES\r\n' +
"--Boundary_with_capital_letters-Random junk";
const r = new Response(new Blob([form_string]), {
headers: [
[
"Content-Type",
"multipart/form-data; boundary=Boundary_with_capital_letters",
],
],
});
return promise_rejects_js(t, TypeError, r.formData(),
"form data should fail to parse");
}, "Invalid form data should not crash the browser");