totaljs / framework4

Total.js framework v4
https://www.totaljs.com
Other
99 stars 36 forks source link

Wrong status code when uploaded file is too large #25

Closed fgnm closed 2 years ago

fgnm commented 2 years ago

Hi, I think this is another small bug in total4, I've this route rule which limit file upload to 1MB:

ROUTE('+POST /admin/news/uploadImage   *News --> @uploadImage', ['upload', 120000], 1024); //Limit 1MB

When try to upload large files it correctly fails, but with a status code inconsistency between HTTP code and Json error description.

image

As you can see from this screenshot, HTTP status code is set to 400 while the error code is 431: Request Header Fields Too Large. I think that HTTP status code should be set to 431 too. (I've noticed this bug because I'm used to check HTTP status code to show errors in front end).

Thanks!

petersirka commented 2 years ago

@fgnm I have fixed it. Today I'll publish a new beta version and I'll release it next week.

petersirka commented 2 years ago

I have released a new beta version: $ npm install total4@beta, you can test it.

fgnm commented 2 years ago

Thanks, works as expected now