Skip to content

Commit a7d709f

Browse files
committed
Issue #5: Tip 5
1 parent c2ae559 commit a7d709f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/UniversalTelegramBot.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ String UniversalTelegramBot::buildCommand(const String& cmd) {
6262
}
6363

6464
String UniversalTelegramBot::sendGetToTelegram(const String& command) {
65-
String mess = "";
65+
String mess;
6666
long now;
6767
bool avail;
6868

@@ -94,7 +94,7 @@ String UniversalTelegramBot::sendGetToTelegram(const String& command) {
9494
while (client->available()) {
9595
char c = client->read();
9696
if (ch_count < maxMessageLength) {
97-
mess = mess + c;
97+
mess += c;
9898
ch_count++;
9999
}
100100
avail = true;
@@ -115,8 +115,8 @@ String UniversalTelegramBot::sendGetToTelegram(const String& command) {
115115

116116
String UniversalTelegramBot::sendPostToTelegram(const String& command, JsonObject payload) {
117117

118-
String body = "";
119-
String headers = "";
118+
String body;
119+
String headers;
120120
long now;
121121
bool responseReceived = false;
122122

@@ -166,11 +166,11 @@ String UniversalTelegramBot::sendPostToTelegram(const String& command, JsonObjec
166166
if (currentLineIsBlank && c == '\n') {
167167
finishedHeaders = true;
168168
} else {
169-
headers = headers + c;
169+
headers += c;
170170
}
171171
} else {
172172
if (ch_count < maxMessageLength) {
173-
body = body + c;
173+
body += c;
174174
ch_count++;
175175
}
176176
}
@@ -202,8 +202,8 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(
202202
GetNextBuffer getNextBufferCallback,
203203
GetNextBufferLen getNextBufferLenCallback) {
204204

205-
String body = "";
206-
String headers = "";
205+
String body;
206+
String headers;
207207
long now;
208208
bool responseReceived = false;
209209
bool finishedHeaders = false;
@@ -320,11 +320,11 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(
320320
if (currentLineIsBlank && c == '\n') {
321321
finishedHeaders = true;
322322
} else {
323-
headers = headers + c;
323+
headers += c;
324324
}
325325
} else {
326326
if (ch_count < maxMessageLength) {
327-
body = body + c;
327+
body += c;
328328
ch_count++;
329329
}
330330
}

0 commit comments

Comments
 (0)