FastLED 3.9.15
Loading...
Searching...
No Matches

◆ fetch_get()

fl::task::Promise< Response > fl::net::http::fetch_get ( const fl::string & url,
const FetchOptions & request )

HTTP GET request.

Definition at line 510 of file fetch.cpp.hpp.

510 {
511 // Create a new request with GET method
512 FetchOptions get_request(url, RequestOptions("GET"));
513
514 // Apply any additional options from the provided request
515 const auto& opts = request.options();
516 get_request.timeout(opts.timeout_ms);
517 for (const auto& header : opts.headers) {
518 get_request.header(header.first, header.second);
519 }
520 if (!opts.body.empty()) {
521 get_request.body(opts.body);
522 }
523
524 return execute_fetch_request(url, get_request);
525}
const RequestOptions & options() const
Get the options for this request.
Definition fetch.h:236
Fetch options builder (fluent interface)
Definition fetch.h:195
Definition url.h:15
fl::task::Promise< Response > execute_fetch_request(const fl::string &url, const FetchOptions &request)
Internal helper to execute a fetch request and return a promise.
Request options (matches JavaScript fetch RequestInit)
Definition fetch.h:184

References fl::net::http::FetchOptions::body(), execute_fetch_request(), fl::net::http::FetchOptions::header(), fl::net::http::FetchOptions::options(), and fl::net::http::FetchOptions::timeout().

Referenced by LoopbackTestRunner::runTest(), test_await_approach(), test_get_endpoint(), test_json_await(), test_json_endpoint(), test_json_response(), test_ping_endpoint(), and test_promise_approach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: