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

◆ fetch_post()

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

HTTP POST request.

Definition at line 197 of file fetch.cpp.

197 {
198 // Create a new request with POST method
199 fetch_options post_request(url, RequestOptions("POST"));
200
201 // Apply any additional options from the provided request
202 const auto& opts = request.options();
203 post_request.timeout(opts.timeout_ms);
204 for (const auto& header : opts.headers) {
205 post_request.header(header.first, header.second);
206 }
207 if (!opts.body.empty()) {
208 post_request.body(opts.body);
209 }
210
211 return execute_fetch_request(url, post_request);
212}
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().

+ Here is the call graph for this function: