HTTPClient Response limit?

I’am test Library HTTPClient to post data to server but response not same from server ?

This code

Serial.println();
     Serial.println("Application>\tStart of Loop.");
     // Request path and body can be set at runtime or at setup.
     request.hostname = "www.jadbill.com";
     request.port = 5000;
     request.path = "/submit";
     String jsonString = "{";
     jsonString += "\"token\":";
     jsonString += "123456789,";
     jsonString += "\"barcode\":";
     jsonString += "[";
     jsonString += "\"";
     jsonString += Barcode[0];
     jsonString += "\"";
     //String checkString;
     //int checkValue = strtol(Barcode[i],checkString,10);
     for(int i=1;i<Number_Product+1;i++){
         if(CheckString(Barcode[i]) == 0){
           jsonString += ",";
           jsonString += Barcode[i];
         }else{
         jsonString += ",";
         jsonString += "\"";
         jsonString += Barcode[i];
         jsonString += "\"";
      }
     }
     //jsonString -= ",";
     jsonString += "],";
     jsonString += "\"quantity\":";
     jsonString += "[";
     jsonString += Quantity[0];
     for(int i=1;i<Number_Product+1;i++){
         jsonString += ",";
         jsonString += Quantity[i];
     }
     jsonString += "]}";
     //String jsonString ="{\"token\":123456789,\"barcode\":[123456789,987654321],\"quantity\":[1,5]}";
     request.body =jsonString;
     Serial.println(jsonString);
     // Get request
     http.post(request, response, headers);
     Serial.print("Application>\tResponse status: ");

     Serial.println(response.status);


     Serial.print("Application>\tHTTP Response Body: ");
     myDelay(1200);
     String responseJson =  response.body;
     /*[{"info":{"api":"Summit API Beep to buy","customerid":"0000000000","name":                                   {"firstname":"admin",
     "lastname":"admin"},"total":60,"token":123456789,"detail":[{"prodname":"barcode3","unitprice":30},
     {"prodname":"barcode3","unitprice":30}]}}]*/
     Serial.println(responseJson);

I think you need to explain your question better to get some help from the community.

I am sure with more detail someone would be happy to help.

He prints out responseJson, but the print is truncated compared to the console also shown.

 Serial.println(responseJson);

So hes asking if theres a limit on response length in the httpClient lib.

1 Like

Ok i fix library in HTTPClient
on httpclient.cpp

while (client.available()) {

// Delete line 189 (&& !Done) is work for Big Json Data <<

@fangda01,

I am having a truncated response issue. I have commented out the entire while (client.available()) { …} statement as you instructed. But I am getting no response data with -1 response status.

Could you please let me know exactly what you did. thanks.

This worked for me. I deleted the “&& !done” part of the while loop at line 189 and got the full response JSON.