IHttpMaxRequestBodySizeFeature and IFormFeature should return 413
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
### Is your feature request related to a problem? Please describe.
`IHttpMaxRequestBodySizeFeature` and `IFormFeature.FormOptions.MultipartBodyLengthLimit` throw different Exceptions when the limit is exceeded.
When these operations fail it results in `500` status code.
### Describe the solution you'd like
The correct `Kestrel` server response should be as `IIS` does, to return a `413` Payload Exceeded error, which would help in identifying the error on the front end, javascript, spa etc. and providing a relevant error message to the user.
### Additional context
I can implement a custom `app.UseExceptionHandler` to manage this, but it involves catching two different exceptions, and then parsing the exception message to see if it is actually a size error, rather than another communication error.
Of note IIS Express returns a `404.13` error, rather than `413`
Contributor guide
Assessment
This issue has not been assessed yet.