vueuse icon indicating copy to clipboard operation
vueuse copied to clipboard

useFetch cannot use formData

Open PoliWen opened this issue 2 years ago • 0 comments

Describe the bug

const {
    data,
    onFetchError,
} = await useFetch(url).post(formData, 'formData').json()

when I use formData, how can I set multipart/form-data?

The error info is: The body of your POST request is not well-formed multipart/form-data.

Reproduction

dev

System Info

browsers

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guidelines.
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
  • [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

PoliWen avatar Jul 01 '22 14:07 PoliWen