Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request.formData() doesn't support application/x-www-form-urlencoded #57

Closed
brophdawg11 opened this issue Apr 13, 2022 · 1 comment · Fixed by #60
Closed

Request.formData() doesn't support application/x-www-form-urlencoded #57

brophdawg11 opened this issue Apr 13, 2022 · 1 comment · Fixed by #60

Comments

@brophdawg11
Copy link
Contributor

Per the spec the Request.formData should support parsing body of Content-Type: application/x-www-form-urlencoded, but it currently only supports multipart/form-data. I have an update locally and can open a PR shortly

@brophdawg11
Copy link
Contributor Author

Here's a quick JS snippet to show the expected behavior:

(async () => {
    let searchParams = new URLSearchParams();
    searchParams.append('key', 'value');
    let request = new Request('/', { 
        method: 'POST', 
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, 
        body: searchParams,
    })
    let requestFormData = await request.formData();
    console.log('key =', requestFormData.get('key'));
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant