I am working on a Java program that implements an HTTP Client. I test it sending requests to a server. GET, POST and DELETE requests work ok. For example after a POST reques
Yes, the issue related to Content-Length
. HTTP Error 411 means
The server refuses to accept the request without a defined Content- Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message.
So when you send an empty RequestBody
in POST/PUT Method then you also need to send Content-Length:0
. So add this header in your request. I don't think this header will cause a problem of you added into Request Object.