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

◆ fetch_get()

fl::promise< response > fl::fetch_get ( const fl::string & url,
const fetch_options & request )

HTTP GET request.

Definition at line 180 of file fetch.cpp.

180 {
181 // Create a new request with GET method
182 fetch_options get_request(url, RequestOptions("GET"));
183
184 // Apply any additional options from the provided request
185 const auto& opts = request.options();
186 get_request.timeout(opts.timeout_ms);
187 for (const auto& header : opts.headers) {
188 get_request.header(header.first, header.second);
189 }
190 if (!opts.body.empty()) {
191 get_request.body(opts.body);
192 }
193
194 return execute_fetch_request(url, get_request);
195}
const RequestOptions & options() const
Get the options for this request.
Definition fetch.h:241
Fetch options builder (fluent interface)
Definition fetch.h:200
fl::promise< response > execute_fetch_request(const fl::string &url, const fetch_options &request)
Internal helper to execute a fetch request and return a promise.
Definition fetch.cpp:72
Request options (matches JavaScript fetch RequestInit)
Definition fetch.h:189

References fl::fetch_options::body(), execute_fetch_request(), fl::fetch_options::header(), fl::fetch_options::options(), and fl::fetch_options::timeout().

Referenced by test_await_approach(), test_json_await(), test_json_response(), and test_promise_approach().

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