ArduinoHttpClient no longer works on certain number of GET requests.

Hi,
i’m using ArduinoHttpClient to run some GET Requests. After a while the connection is not working anymore and the response status from http.get is always 0. I have to restart arduino so that the sketch works again.
The Sketch.

#include <SPI.h>
#include <WiFi101.h>
#include <HttpClient.h>
#include "arduino_secrets.h"
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
int keyIndex = 0;

#define WINC_CS   34
#define WINC_IRQ  32
#define WINC_RST  35
#define WINC_EN   36
#define WINC_WAKE 33

int status = WL_IDLE_STATUS;
char host[] = CLOUD_HOST;
WiFiServer server(80);
WiFiClient client;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ;
  }

  WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    while (true);
  }

  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
    delay(10000);
  }
  Serial.println("Connected to wifi");
}

void loop() {
  sendGet();
}

void sendGet() {
  HttpClient http = HttpClient(client, host, 80);
  char uuid[37];
  long startTime = millis();
  if (!http.get(PAGE)) {
    if (http.responseStatusCode() == 200) {
      String response = http.responseBody();
      // Parse UUID from JSON String
      uint8_t i = 0;
      while (i < 36) {
        uuid[i] = response[15 + i - 1];
        i++;
      }
      uuid[i] = '\0';
      Serial.println(uuid);
      Serial.print("Time in sec: ");
      long elapsedTime =   millis() - startTime;
      Serial.print( (int)(elapsedTime / 1000L));
      Serial.println();
    }
  }
  delay(5000);
}

The Output:

Connected to wifi
901270e9-6ebd-4ca9-96f3-f14769c564bf
Time in sec: 10
7f84100b-f4f9-4ff2-92d1-dd3c903407f4
Time in sec: 12
67a08d35-c02d-48eb-9f8b-1193cba76c08
Time in sec: 11
4062921c-35df-4496-ab95-cdfb5014047a
Time in sec: 11
ecab82de-d24a-4c66-82e8-6ef56cf88ea6
Time in sec: 10
feb047c5-1af6-46da-93d4-a00535e5a431
Time in sec: 10
b15f46ba-03b7-465a-90bb-54dc32ca1620
Time in sec: 14
21d54518-7d86-41ef-9f60-8aa1c1b8e824
Time in sec: 12
40001f0d-2020-4525-aa08-aca3f3a340be
Time in sec: 13
e6299856-2e37-4e4b-ab6e-3413ccb9f219
Time in sec: 18
ecd4a1dd-4b6d-4479-bd2d-00872d051db2
Time in sec: 12
433fee06-4357-4910-a348-fd2436a88f13
Time in sec: 13
4a51e8fc-4bc2-495a-9ee5-3ad4ee3b825f
Time in sec: 13
c74ac5c4-8d6b-4b7f-b188-f634a30856fb
Time in sec: 12
22b99274-8e5a-471b-969b-a4ee691396ac
Time in sec: 11
9c2226eb-a719-4719-9cec-98b9f89987f3
Time in sec: 11
d682533c-c755-491e-8770-d27e19777365
Time in sec: 18
6475b2aa-61ca-4fd7-ae02-907a403e7d12
Time in sec: 12
45e92fdf-04bf-4efb-9705-968b1997d113
Time in sec: 10
8242133b-103a-423f-8941-90751feccaae
Time in sec: 11
b627ab70-36ce-4381-acc4-d2fe7235ddff
Time in sec: 10
8b3679ff-5916-4093-8cf5-ee453aa747a3
Time in sec: 11
67bc9d6f-e39a-46ef-8630-f8a0ed2274f5
Time in sec: 10
b172db74-e55b-4d3b-bb7d-70166369c27a
Time in sec: 11
7120c8a7-75c6-4f61-a671-f222007a0eef
Time in sec: 11
4e3e4787-6cb1-4e21-8d9c-8cea161020c9
Time in sec: 13

Does anyone have any idea how to change this sketch so it runs for a long time without any connection issues?

Cheers

I would start with not using String

I tryed with char response but then I get
cannot convert 'String' to 'char
' in initialization

... and in ArduinoHttpClient.h:

  /** Return the response body as a String
    Also skips response headers if they have not been read already
    MUST be called after responseStatusCode()
    @return response body of request as a String
  */
  String responseBody();

Do I have to call HttpClient.close(); after read successfully the body?