Thanks to visit codestin.com
Credit goes to github.com

Skip to content

readFormData() doesn't work #561

@luca-smartpricing

Description

@luca-smartpricing

Environment

Reproduction

https://stackblitz.com/edit/github-vcth9o?file=app.vue

Describe the bug

Hi!
When i try to read FormData with const formData = await readFormData(event) I receive this error:
[nuxt] [request error] [unhandled] [500] Error: Unexpected end of multipart data
It's come from Busboy

The problem appear when i set Content-Type on nuxt useFetch (also if i set lowercase content-type)

const headers = new Headers({
    'Content-Type': 'multipart/form-data; boundary=someBoundary',
  })
  const formData = new FormData()
  formData.append('test', 'string')

  const { data, error } = await useFetch('/api/file-upload', {
    method: 'POST',
    headers,
    body: formData,
  })

If i don't set Content-Type in local dev work perfect but on Netlify the problem appear again.
Did you know why?
Thank guys!

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions