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

Function execute_fetch_request

src/fl/net/http/fetch.cpp.hpp:54–77  ·  view source on GitHub ↗

Internal helper to execute a fetch request and return a promise

Source from the content-addressed store, hash-verified

52
53// Internal helper to execute a fetch request and return a promise
54fl::task::Promise<Response> execute_fetch_request(const fl::string& url, const FetchOptions& request) {
55 // Create a promise for this request
56 auto promise = fl::task::Promise<Response>::create();
57
58 // Register with fetch manager to ensure it's tracked
59 FetchManager::instance().register_promise(promise);
60
61 // Get the actual URL to use (use request URL if provided, otherwise use parameter URL)
62 fl::string fetch_url = request.url().empty() ? url : request.url();
63
64 // Convert our request to the existing WASM fetch system
65 auto wasm_request = ::fl::WasmFetchRequest(fetch_url);
66
67 // Use lambda that captures the promise directly (shared_ptr is safe to copy)
68 // Make the lambda mutable so we can call non-const methods on the captured promise
69 wasm_request.response([promise](const Response& resp) mutable {
70 // Complete the promise directly - no need for double storage
71 if (promise.valid()) {
72 promise.complete_with_value(resp);
73 }
74 });
75
76 return promise;
77}
78
79
80

Callers 9

fetchFunction · 0.85
fetch_getFunction · 0.85
fetch_postFunction · 0.85
fetch_putFunction · 0.85
fetch_deleteFunction · 0.85
fetch_headFunction · 0.85
fetch_http_optionsFunction · 0.85
fetch_patchFunction · 0.85
fetch_requestFunction · 0.85

Calls 15

createFunction · 0.85
WasmFetchRequestClass · 0.85
every_msFunction · 0.85
register_promiseMethod · 0.80
urlMethod · 0.80
responseMethod · 0.80
complete_with_valueMethod · 0.80
is_doneMethod · 0.80
cancelMethod · 0.80
complete_with_errorMethod · 0.80
add_taskMethod · 0.80
set_bodyMethod · 0.80

Tested by

no test coverage detected