|
Post by AMI_ivywang on Mar 31, 2023 6:59:56 GMT
If send a patch or post request without request header Content-Length and Transfer-Encoding, what the response will be? 411 - Length Required or 406 - Not Acceptable? Can we return "400 - Bad Request with error message Base.1.12.UnrecognizedRequestBody" in response body instead of 411 or 406? Refer to the document DSP0266_1.15.1.pdf Table 6 — Request headers Table 14 — HTTP status codes
|
|
|
Post by mraineri on Mar 31, 2023 12:52:11 GMT
If both Content-Length and Transfer-Encoding are absent, you can accept the request if your service is able to determine the length on its own; the size can be calculated dynamically based on the size of the request body. However, if your web service is not flexible to determine this and you require the length to be sent in a header, HTTP 411 would be the correct response.
I can imagine there are also cases where a resource could have a very large payload, and you want to protect yourself prior to accepting anything from the client that could go beyond your maximum buffer sizes. In these cases, HTTP 411 would still be used.
|
|