wobsoriano / h3-formidable

File upload parsing utility for h3 and Nuxt.
MIT License
56 stars 3 forks source link

All Post requests with body stop working :) #12

Open Dmytro-Tihunov opened 8 months ago

Dmytro-Tihunov commented 8 months ago

Environment: Nuxt v3.7.4

A few days ago, I was struggling with a problem in my app. All post requests using useFetch or $fetch with a body stopped working. It seems to be a bug. Tried on 2 different environments. Problem solved after uninstalling the h3-formidable

sohilpro commented 8 months ago

Did you solve this problem?

Dmytro-Tihunov commented 8 months ago

Did you solve this problem?

Just install formidable and use it without this plugin ) everything works

wobsoriano commented 8 months ago

Would be nice to know if you used the global middleware when you got this issue

jeremymarc commented 3 months ago

got the same issue and yes it was with the middleware

wobsoriano commented 1 month ago

What if you ditch the middleware and just do it to certain routes like:

// /server/api/upload.ts
import { readFiles } from 'h3-formidable'

export default eventHandler(async (event) => {
  const { fields, files, form } = await readFiles(event, {
    // formidable options
    // https://github.com/node-formidable/formidable#options
  })
})