If an error happens while the client is still uploading the request body, what should an HTTP server do? Assume that it's not possible to discard the whole body, because the error is for example traffic exceeded or server shutdown.
- Should it already send an HTTP error even though the upload hasn't finished?
- Should it close the connection?
- Both?
According to this answer, the spec-compliant way is to send an error early and the client should stop sending the body.
However, the major web browsers will continue sending the body unless you close the connection, too.
If the client is not a web browser (but rather an HTTP client library, e.g. talking to a REST API), what is the recommended behavior?