Weird behaviour WiFiClientSecure

Hello everyone,

I'm trying to get ride of some useless String in my code in order to prevent fragmentation and so on. My code is used to communicate with Telegram server. The connection to the server is not a problem everything works fine on this side.

Here is the code I use to receive a message:

String Requete_Internet = "GET /bot" + TOKEN_Bot + "/getUpdates?offset=" + Update_ID + "&limit=1&timeout=" + String(Timeout) + " HTTP/1.1";
Serv_Telegram.println(Requete_Internet);

Serv_Telegram.println(("Host: api.telegram.org"));
Serv_Telegram.println();

Note that TOKEN_Bot and Update_ID are String and Timeout is an uint8_t

This works well, no problem. Then I tried to get ride of the String Requete_Internet by doing this:

Serv_Telegram.print("GET /bot");
Serv_Telegram.print(TOKEN_Bot);
Serv_Telegram.print("/getUpdates?offset=");
Serv_Telegram.print(Update_ID);
Serv_Telegram.print("&limit=1&timeout=");
Serv_Telegram.print(String(Timeout));
Serv_Telegram.println(" HTTP/1.1");

Serv_Telegram.println(("Host: api.telegram.org"));
Serv_Telegram.println();

And this doesn't work. The server doesn't respond anything, not even 'Bad request'.
I tried to force cast everything as String, I also tried to wrapped everything in urlEncore() but no success.

By printing the result, it seems to me that both requests are exactly the same:

Serial.print(("GET /bot"));
Serial.print(TOKEN_Bot);
Serial.print(("/getUpdates?offset="));
Serial.print(Update_ID);
Serial.print(("&limit=1&timeout="));
Serial.print(String(Timeout));
Serial.println((" HTTP/1.1"));

// Output the same in the serial monitor as

String Requete_Internet = "GET /bot" + TOKEN_Bot + "/getUpdates?offset=" + Update_ID + "&limit=1&timeout=" + String(Timeout) + " HTTP/1.1";
Serial.println(Requete_Internet);

If you want something even weirder, I've done it also for the sending message part and this works without any problem:

Serv_Telegram.print("GET /bot");
Serv_Telegram.print(TOKEN_Bot);
Serv_Telegram.print("/sendMessage?chat_id=");
Serv_Telegram.print(Id_Destinataire);
Serv_Telegram.print("&text=");
Serv_Telegram.print(urlEncode(Message));
Serv_Telegram.println(" HTTP/1.1");

Serv_Telegram.println("Host: api.telegram.org");
Serv_Telegram.println();

Is there someone that could have an idea of what could be happening here pls?

I found the response.

It turns out that at the very beginning, Update_ID is an empty String.
It seems that Serv_Telegram.print() doesn't like it. I don't understand why, especially that the output strings in the serial monitor are exactly the same.
Maybe it prints an '\0' whereas it shouldn't.

Solution: Make sure none of your Strings are empty