We have a frontend error message that appears via a toast when someone tries to upload a pdf file larger than 100MB. That part is working great. But I need to be able to set that file size limitation parameter in the proxy as well. I read that you can simply change your next config to use the following.
const nextConfig = {
api: {
bodyParser: {
sizeLimit: '100mb', // Adjusted to 100mb to prevent large file uploads
},
},
}
But how would you actually write a test (jest or Cypress) that would test that a large file is not able to be sent via the proxy to our backend? I'm thinking it would have to be a unit test since the frontend component technically blocks it going to the Nextjs backend at all. I've been struggling with getting this test to work quite right.
Here is my route.test.ts file, keep in mind there are quite a few errors here...
https://gist.github.com/mtander/9d87a5cc782383b89c69e4e763d583fb