Fork of SandBox's original mbed-http (https://os.mbed.com/teams/sandbox/code/mbed-http/) and update for MbedOS6+ Content of TESTS folder was replaced with basic examples form original SandBox's HelloWorld

Revision:
22:71fc1b1894f8
Parent:
20:0e63d6a93c02
Child:
23:15fa2726f793
diff -r fcd2bfd31a39 -r 71fc1b1894f8 source/http_request.h
--- a/source/http_request.h	Thu Dec 14 16:19:22 2017 +0700
+++ b/source/http_request.h	Wed Jan 03 11:23:22 2018 +0000
@@ -139,12 +139,27 @@
         size_t request_size = 0;
         char* request = request_builder->build(body, body_size, request_size);
 
-        nsapi_size_or_error_t send_result = socket->send(request, request_size);
+        nsapi_size_or_error_t total_send_count = 0;
+        while (total_send_count < request_size) {
+            nsapi_size_or_error_t send_result = socket->send(request + total_send_count, request_size - total_send_count);
+
+            if (send_result < 0) {
+                total_send_count = send_result;
+                break;
+            }
+
+            if (send_result == 0) {
+                break;
+            }
+
+            total_send_count += send_result;
+        }
+
 
         free(request);
 
-        if (send_result != request_size) {
-            error = send_result;
+        if (total_send_count < 0) {
+            error = total_send_count;
             return NULL;
         }