FoalTS / foal

Full-featured Node.js framework 🚀
https://foalts.org/
MIT License
1.9k stars 142 forks source link

Question: body size limits #1202

Closed lcnvdl closed 1 year ago

lcnvdl commented 1 year ago

Hello! I'm aware of the capability of change the request size limit by using the config. Is there any way to change the limit but ONLY for a specific url or request?

image

If not, the alternative that occurs to me to solve it is to increase the limit as much as possible, and then reduce it in the controllers by using Hooks. I don't know if this alternative has consequences, since I will be receiving the heavy content before rejecting it.

Thanks!

LoicPoullain commented 1 year ago

Hi @lcnvdl 👋

Yes, this is a limitation of the framework as the parsing of the request body is not done by Foal itself but by the Express middleware bodyParser. Internal Express middlewares are only applied at global level (to the entire application).

It is therefore not possible to change the limit for a specific URL or request. 😕