MCPcopy Create free account
hub / github.com/SmingHub/Sming / testHttpCommon

Method testHttpCommon

tests/HostTests/modules/Network/Http.cpp:22–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 }
21
22 void testHttpCommon()
23 {
24#if DEBUG_VERBOSE_LEVEL == DBG
25 for(int i = 0; i < 100; ++i) {
26 auto err = HttpError(i);
27 Serial << _F("httpError(") << i << ") = \"" << err << "\", \"" << httpGetErrorDescription(err) << '"'
28 << endl;
29 }
30
31 for(int i = 100; i < 550; ++i) {
32 Serial << _F("HTTP Status(") << i << ") = \"" << HttpStatus(i) << '"' << endl;
33 }
34#endif
35
36 TEST_CASE("http lookups")
37 {
38 auto s = toString(HPE_UNKNOWN);
39 REQUIRE(s == "HPE_UNKNOWN");
40 s = httpGetErrorDescription(HPE_INVALID_URL);
41 REQUIRE(s == "invalid URL");
42 s = toString(HTTP_STATUS_TOO_MANY_REQUESTS);
43 DEFINE_FSTR_LOCAL(too_many_requests, "too many requests");
44 REQUIRE(s.equalsIgnoreCase(too_many_requests));
45 }
46 }
47
48 static void printHeaders([[maybe_unused]] const HttpHeaders& headers)
49 {

Callers

nothing calls this directly

Calls 5

HttpErrorEnum · 0.85
httpGetErrorDescriptionFunction · 0.85
HttpStatusEnum · 0.85
toStringFunction · 0.50
equalsIgnoreCaseMethod · 0.45

Tested by

no test coverage detected