Skip to content

Commit 234941c

Browse files
committed
MCU8MASS-1943 Update HTTP examples' print message to HTTP status code instead of just result code
1 parent 68871e0 commit 234941c

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

examples/http/http.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ void setup() {
3636
Log.info("Configured to HTTP");
3737

3838
HttpResponse response = HttpClient.get("/get");
39-
Log.infof("GET - status code: %u, data size: %u\r\n",
39+
Log.infof("GET - HTTP status code: %u, data size: %u\r\n",
4040
response.status_code,
4141
response.data_size);
4242

4343
response = HttpClient.post("/post", "{\"hello\": \"world\"}");
44-
Log.infof("POST - status code: %u, data size: %u\r\n",
44+
Log.infof("POST - HTTP status code: %u, data size: %u\r\n",
4545
response.status_code,
4646
response.data_size);
4747

examples/http_get_time/http_get_time.ino

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,19 @@ void setup() {
4747
HttpResponse response;
4848
response = HttpClient.get(TIMEZONE_URI);
4949
if (response.status_code != HttpClient.STATUS_OK) {
50-
Log.errorf("Error when performing a GET request on %s%s. Got status "
51-
"code = %d. Exiting...\r\n",
52-
TIMEZONE_URL,
53-
TIMEZONE_URI,
54-
response.status_code);
50+
Log.errorf(
51+
"Error when performing a GET request on %s%s. Got HTTP status"
52+
"code = %d. Exiting...\r\n",
53+
TIMEZONE_URL,
54+
TIMEZONE_URI,
55+
response.status_code);
5556
return;
5657
}
5758

58-
Log.infof(
59-
"Successfully performed GET request. Status Code = %d, Size = %d\r\n",
60-
response.status_code,
61-
response.data_size);
59+
Log.infof("Successfully performed GET request. HTTP status Code = %d, Size "
60+
"= %d\r\n",
61+
response.status_code,
62+
response.data_size);
6263

6364
String body = HttpClient.readBody(512);
6465

examples/https/https.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ void setup() {
3636
Log.info("Configured to HTTPS");
3737

3838
HttpResponse response = HttpClient.get("/get");
39-
Log.infof("GET - status code: %u, data size: %u\r\n",
39+
Log.infof("GET - HTTP status code: %u, data size: %u\r\n",
4040
response.status_code,
4141
response.data_size);
4242

4343
response = HttpClient.post("/post", "{\"hello\": \"world\"}");
44-
Log.infof("POST - status code: %u, data size: %u\r\n",
44+
Log.infof("POST - HTTP status code: %u, data size: %u\r\n",
4545
response.status_code,
4646
response.data_size);
4747

examples/https_with_header/https_with_header.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void setup() {
3838
// HttpClient.post("<endpoint>", "<data>", "Authorization: Bearer");
3939
HttpResponse response = HttpClient.get("/get", "Authorization: Bearer");
4040

41-
Log.infof("GET - status code: %u, data size: %u\r\n",
41+
Log.infof("GET - HTTP status code: %u, data size: %u\r\n",
4242
response.status_code,
4343
response.data_size);
4444

test/test_examples.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ def example_test_data():
220220
"expectation": "\\[INFO\\] Configured to HTTP"
221221
},
222222
{
223-
"expectation": "\\[INFO\\] GET - status code: 200, data size: (\\d{1,})"
223+
"expectation": "\\[INFO\\] GET - HTTP status code: 200, data size: (\\d{1,})"
224224
},
225225
{
226-
"expectation": "\\[INFO\\] POST - status code: 200, data size: (\\d{1,})"
226+
"expectation": "\\[INFO\\] POST - HTTP status code: 200, data size: (\\d{1,})"
227227
},
228228
{
229229
"expectation": "\\[INFO\\] Body: {"
@@ -246,7 +246,7 @@ def example_test_data():
246246
"expectation": "\\[INFO\\] --- Configured to HTTP ---"
247247
},
248248
{
249-
"expectation": "\\[INFO\\] Successfully performed GET request. Status Code = 200, Size = (\\d{1,})"
249+
"expectation": "\\[INFO\\] Successfully performed GET request. HTTP status code = 200, Size = (\\d{1,})"
250250
},
251251
{
252252
"expectation": "\\[INFO\\] Got the time \\(unixtime\\) (\\d{10})"
@@ -269,10 +269,10 @@ def example_test_data():
269269
"expectation": "\\[INFO\\] Configured to HTTPS"
270270
},
271271
{
272-
"expectation": "\\[INFO\\] GET - status code: 200, data size: (\\d{1,})"
272+
"expectation": "\\[INFO\\] GET - HTTP status code: 200, data size: (\\d{1,})"
273273
},
274274
{
275-
"expectation": "\\[INFO\\] POST - status code: 200, data size: (\\d{1,})"
275+
"expectation": "\\[INFO\\] POST - HTTP status code: 200, data size: (\\d{1,})"
276276
},
277277
{
278278
"expectation": "\\[INFO\\] Body: {"
@@ -293,7 +293,7 @@ def example_test_data():
293293
"expectation": "\\[INFO\\] Performing GET with header..."
294294
},
295295
{
296-
"expectation": "\\[INFO\\] GET - status code: 200, data size: (\\d{1,})"
296+
"expectation": "\\[INFO\\] GET - HTTP status code: 200, data size: (\\d{1,})"
297297
},
298298
{
299299
"expectation": "\\[INFO\\] Response: {"

0 commit comments

Comments
 (0)