Skip to content

Commit 1453ab1

Browse files
authored
Added possibility of sending POST with empty payload
Specification does not prohibit the sending of an empty POST requests. In this case "Content-Length: 0" should be set. See thread here: http://lists.w3.org/Archives/Public/ietf-http-wg/2010JulSep/0276.html
1 parent 199fe0f commit 1453ab1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ int HTTPClient::sendRequest(const char * type, uint8_t * payload, size_t size)
396396
if(payload && size > 0) {
397397
addHeader(F("Content-Length"), String(size));
398398
}
399+
else {
400+
addHeader(F("Content-Length"), "0");
401+
}
399402

400403
// send Header
401404
if(!sendHeader(type)) {

0 commit comments

Comments
 (0)