164 {
165 FL_WARN(
"APPROACH 2: await_top_level pattern with explicit types");
166
167
168
170 request_config.timeout(5000)
171 .header("User-Agent", "FastLED/Client-Tutorial");
172
173
174
176
177
178
179
181
182
184
185
187
188 FL_WARN(
"SUCCESS [Await] HTTP fetch successful! Status: "
190
191
192
195 FL_WARN(
"CONTENT [Await] Content-Type: " << *content_type);
196 }
197
198
200 if (response_body.
length() >= 100) {
201 FL_WARN(
"RESPONSE [Await] First 100 characters: " << response_body.
substr(0, 100));
202 } else {
203 FL_WARN(
"RESPONSE [Await] Full response (" << response_body.
length()
204 << " chars): " << response_body);
205 }
206
207
209 } else {
210
211
212 FL_WARN(
"ERROR [Await] Request failed: " <<
result.error_message());
213
214
216 }
217}
bool has_value() const FL_NOEXCEPT
Response & status(int code)
Set HTTP status code.
fl::size length() const FL_NOEXCEPT
Fetch options builder (fluent interface)
HTTP response class (unified interface)
string substr(fl::size start, fl::size length) const FL_NOEXCEPT
Promise class that provides fluent .then() and .catch_() semantics This is a lightweight wrapper arou...
Result type for promise operations.
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
fl::task::Promise< Response > fetch_get(const fl::string &url, const FetchOptions &request)
HTTP GET request.
PromiseResult< T > await_top_level(Promise< T > p)
Synchronously wait for a promise to complete (ONLY safe in top-level contexts)
expected< T, E > result
Alias for expected (Rust-style naming)
asio::http::Response http_response
Representation of an 8-bit RGB pixel (Red, Green, Blue)