mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
HTTPClient: Added possibility of sending POST with empty payload (#4275)
* 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
This commit is contained in:
committed by
david gauchard
parent
6272b49406
commit
e81bb6f57c
@ -656,9 +656,7 @@ int HTTPClient::sendRequest(const char * type, uint8_t * payload, size_t size)
|
||||
return returnError(HTTPC_ERROR_CONNECTION_REFUSED);
|
||||
}
|
||||
|
||||
if(payload && size > 0) {
|
||||
addHeader(F("Content-Length"), String(size));
|
||||
}
|
||||
addHeader(F("Content-Length"), String(payload && size > 0 ? size : 0));
|
||||
|
||||
// send Header
|
||||
if(!sendHeader(type)) {
|
||||
|
Reference in New Issue
Block a user