LibWeb: Implement formData() method steps for x-www-form-urlencoded

The Response interface of the Fetch API can now parse form urlencoded
bodies when Content-Type is set to 'application/x-www-form-urlencoded'.
This commit is contained in:
Kenneth Myhra 2024-07-22 13:49:07 +02:00 committed by Andreas Kling
parent 7047fcf761
commit b8fa572c67
Notes: github-actions[bot] 2024-07-23 07:03:35 +00:00
5 changed files with 46 additions and 6 deletions

View file

@ -0,0 +1,17 @@
<script src="../include.js"></script>
<script>
test(() => {
const data = "param-a=value-a&param-b=value-b&param-c=value-c1&param-c=value-c2";
const response = new Response(data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
response.formData().then((formData) => {
println(formData.get("param-a"));
println(formData.get("param-b"));
println(formData.getAll("param-c"));
});
});
</script>