@@ -627,8 +627,18 @@ WiFiClient* HTTPClient::getStreamPtr(void)
627
627
*/
628
628
int HTTPClient::writeToStream (Stream * stream)
629
629
{
630
+ return writeToPrint (stream);
631
+ }
630
632
631
- if (!stream) {
633
+ /* *
634
+ * write all message body / payload to Print
635
+ * @param print Print *
636
+ * @return bytes written ( negative values are error codes )
637
+ */
638
+ int HTTPClient::writeToPrint (Print * print)
639
+ {
640
+
641
+ if (!print) {
632
642
return returnError (HTTPC_ERROR_NO_STREAM);
633
643
}
634
644
@@ -645,7 +655,7 @@ int HTTPClient::writeToStream(Stream * stream)
645
655
if (_transferEncoding == HTTPC_TE_IDENTITY) {
646
656
// len < 0: transfer all of it, with timeout
647
657
// len >= 0: max:len, with timeout
648
- ret = _client->sendSize (stream , len);
658
+ ret = _client->sendSize (print , len);
649
659
650
660
// do we have an error?
651
661
if (_client->getLastSendReport () != Stream::Report::Success) {
@@ -673,7 +683,7 @@ int HTTPClient::writeToStream(Stream * stream)
673
683
// data left?
674
684
if (len > 0 ) {
675
685
// read len bytes with timeout
676
- int r = _client->sendSize (stream , len);
686
+ int r = _client->sendSize (print , len);
677
687
if (_client->getLastSendReport () != Stream::Report::Success)
678
688
// not all data transferred
679
689
return returnError (StreamReportToHttpClientReport (_client->getLastSendReport ()));
0 commit comments