mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +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:
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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user