| 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 | { |
nothing calls this directly
no test coverage detected