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

NotSupportedError: multipart/form-data not supported #1979

Closed
kettanaito opened this issue Mar 1, 2023 · 1 comment
Closed

NotSupportedError: multipart/form-data not supported #1979

kettanaito opened this issue Mar 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@kettanaito
Copy link
Contributor

kettanaito commented Mar 1, 2023

Bug Description

Getting the following error:

 Promise {
      <rejected> NotSupportedError: multipart/form-data not supported
          at Request.formData (node:internal/deps/undici/undici:2311:19)

Reproducible By

const formData = new FormData()
formData.append('username', 'john.maverick')

const req = new Request('http://localhost', {
  method: 'POST',
  body: formData,
})

console.log(req.formData())

This example uses Node.js globals for Fetch API so I'm not importing any polyfills for neither Request nor FormData.

Expected Behavior

Calling request.formData() must return a Promise that resolves to a FormData instance containing the fields initially supplied to the Request constructor.

Logs & Screenshots

Environment

  • Node 18.8.0

Additional context

I've skimmed Undici's source and couldn't find this NotSupportedError instance. I suspect this was indeed unsupported in the past but has been implemented in the newer versions of Node? I'd like to know when this was added, if ever. Thanks.

@kettanaito kettanaito added the bug Something isn't working label Mar 1, 2023
@KhafraDev
Copy link
Member

https://github.com/nodejs/undici/releases/tag/v5.11.0 which seems to have been added in v18.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants