danwrong / restler

REST client library for node.js
MIT License
1.99k stars 391 forks source link

don't submit content-length header on GET requests #184

Open gmdayley opened 9 years ago

gmdayley commented 9 years ago

According to the HTTP spec the presence of the 'Content-Length' header signals that there is a message body (even if the length is 0). Also, since according to the spec, GET requests do not allow message bodies and therefore should not include the 'Content-Length' header.

From RFC 2616, Section 4.3:

"The presence of a message-body in a request is signaled by the inclusion of a Content-Length or Transfer-Encoding header field in the request's message-headers. A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests."

damienleroux commented 8 years ago

Hi,

It is possible to include this changes to the base branch. I met the same problem. My server is not designed to handle the "content-length" header from GET request...

Thank you gmdayley for your code