MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_ping_endpoint

Function test_ping_endpoint

examples/Asio/ClientValidation/ClientValidationReal.h:169–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void test_ping_endpoint() {
170 FL_WARN("\n=== Test 3: GET /ping (Health Check) ===");
171
172 fl::task::Promise<fl::net::http::Response> promise = fl::net::http::fetch_get("http://localhost:8081/ping");
173 fl::task::PromiseResult<fl::net::http::Response> result = fl::task::await_top_level(promise);
174
175 if (!result.ok()) {
176 FL_WARN("✗ FAILED: " << result.error_message());
177 tests_failed++;
178 state = FAILED;
179 return;
180 }
181
182 const fl::net::http::Response& resp = result.value();
183 if (resp.status() != 200) {
184 FL_WARN("✗ FAILED: Status " << resp.status() << " " << resp.status_text());
185 tests_failed++;
186 state = FAILED;
187 return;
188 }
189
190 fl::string body = resp.text();
191 if (body != "pong\n") {
192 FL_WARN("✗ FAILED: Expected 'pong\\n', got '" << body << "'");
193 tests_failed++;
194 state = FAILED;
195 return;
196 }
197
198 FL_WARN("✓ PASSED");
199 FL_WARN(" Response: " << body.substr(0, body.length() - 1)); // Strip newline for display
200 tests_passed++;
201}
202
203void setup() {
204 Serial.begin(115200);

Callers 1

loopFunction · 0.85

Calls 8

fetch_getFunction · 0.85
await_top_levelFunction · 0.85
statusMethod · 0.80
okMethod · 0.45
error_messageMethod · 0.45
valueMethod · 0.45
substrMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected