next-http-proxy-middleware icon indicating copy to clipboard operation
next-http-proxy-middleware copied to clipboard

Update documentation for multipart/form-data requests

Open lorenzodejong opened this issue 4 years ago • 4 comments

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.

lorenzodejong avatar Aug 03 '21 13:08 lorenzodejong

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

@all-contributors please add @lorenzodejong for doc

stegano avatar Aug 16 '21 13:08 stegano

@stegano

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

allcontributors[bot] avatar Aug 16 '21 13:08 allcontributors[bot]

Perfect, great improvement to the existing documentation!

lorenzodejong avatar Aug 24 '21 11:08 lorenzodejong

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

bellmatthewf avatar Sep 20 '23 05:09 bellmatthewf