stegano / next-http-proxy-middleware

HTTP Proxy middleware available in API Middleware provided by Next.js.
235 stars 19 forks source link

Update documentation for multipart/form-data requests #33

Open lorenzodejong opened 3 years ago

lorenzodejong commented 3 years ago

Thanks for open sourcing this library, saved me quite some time while implementing my API proxy.

While working with multipart/form-data requests i've noticed that the Next.js bodyParser tries to parse the body, causing it to corrupt the binary content of all files in the request. Therefore (in my case) it's desired to disable the bodyParser entirely in the API route (https://nextjs.org/docs/api-routes/api-middlewares#custom-config).

export const config = {
    api: {
        bodyParser: false
    }
};

This library handles all other requests/content-types correctly. Perhaps it would be an idea to document this to safe others some time with similar issues.

stegano commented 3 years ago

Hi @lorenzodejong Thanks for your opinion Added to the README.md now! 😀

@all-contributors please add @lorenzodejong for doc

allcontributors[bot] commented 3 years ago

@stegano

I've put up a pull request to add @lorenzodejong! :tada:

lorenzodejong commented 3 years ago

Perfect, great improvement to the existing documentation!

bellmatthewf commented 1 year ago

Does turning off the bodyParser cause any issues with other types of requests (what is it there for)?