Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion libraries/HTTPClient/src/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,21 @@ int HTTPClient::sendRequest(const char * type, uint8_t * payload, size_t size)

// send Payload if needed
if(payload && size > 0) {
if(_client->write(&payload[0], size) != size) {
size_t sent_bytes = 0;
while(sent_bytes < size){
size_t sent = _client->write(&payload[sent_bytes], size - sent_bytes);
if (sent == 0){
log_w("Failed to send chunk! Lets wait a bit");
delay(100);
sent = _client->write(&payload[sent_bytes], size - sent_bytes);
if (sent == 0){
log_e("Failed to send chunk!");
break;
}
}
sent_bytes += sent;
}
if(sent_bytes != size){
return returnError(HTTPC_ERROR_SEND_PAYLOAD_FAILED);
}
}
Expand Down