libfetch 0.0.0
A lightweight asynchronous HTTP/1.1 client library implementing a subset of the WHATWG Fetch API.
Loading...
Searching...
No Matches
Async Promises

Handle asynchronous fetch operations. More...

Data Structures

struct  fetch_promise
 Promise for asynchronous fetch operations. More...
 

Typedefs

typedef void(* fetch_on_fulfilled_cb) (fetch_response_t *response, void *userdata)
 Callback for successful promise completion.
 
typedef void(* fetch_on_rejected_cb) (fetch_error_t error, const char *message, void *userdata)
 Callback for promise rejection/failure.
 
typedef struct fetch_promise fetch_promise_t
 Promise for asynchronous fetch operations.
 

Detailed Description

Handle asynchronous fetch operations.

Typedef Documentation

◆ fetch_on_fulfilled_cb

typedef void(* fetch_on_fulfilled_cb) (fetch_response_t *response, void *userdata)

Callback for successful promise completion.

Parameters
responseThe HTTP response (borrowed reference, do not free)
userdataUser-provided data

◆ fetch_on_rejected_cb

typedef void(* fetch_on_rejected_cb) (fetch_error_t error, const char *message, void *userdata)

Callback for promise rejection/failure.

Parameters
errorThe error code
messageError message
userdataUser-provided data

◆ fetch_promise_t

Promise for asynchronous fetch operations.

Represents an ongoing or completed asynchronous HTTP request.

Note
Memory: Caller owns the promise and must call fetch_promise_free()
Threading: Promises are not thread-safe and must be used from the same thread