MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / onDeferred

Method onDeferred

Tests/Libraries/Http/HttpAsyncClientTest.cpp:1339–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1337
1338 SC_TEST_EXPECT(client.init(clientStorage));
1339 SC_TEST_EXPECT(StringBuilder::format(url1, "http://127.0.0.1:{}/first", port1));
1340 SC_TEST_EXPECT(StringBuilder::format(url2, "http://127.0.0.1:{}/second", port2));
1341
1342 client.onResponse = [this, &ctx](HttpAsyncClientResponse& response)
1343 {
1344 ctx.collector.attach(response,
1345 [this, &ctx](HttpAsyncClientResponse& completedResponse)
1346 {
1347 ctx.collector.detach();
1348 ctx.completions++;
1349 if (ctx.completions == 1)
1350 {
1351 SC_TEST_EXPECT(completedResponse.getParser().statusCode == 200);
1352 SC_TEST_EXPECT(StringView(ctx.collector.view()) == "first");
1353 SC_TEST_EXPECT(ctx.scheduleDeferred(Context::DeferredAction::RepeatFirstRequest));
1354 }
1355 else if (ctx.completions == 2)

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
viewMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected