···
Use Eio.Fiber.both or Eio.Fiber.all for concurrent execution.
(** A stateful HTTP client that maintains cookies, auth, configuration, and
+
connection pools across requests. *)
(** {2 Creation and Configuration} *)
+
?http_pool:('clock Eio.Time.clock, 'net Eio.Net.t) Conpool.t ->
+
?https_pool:('clock Eio.Time.clock, 'net Eio.Net.t) Conpool.t ->
?cookie_jar:Cookeio.jar ->
?default_headers:Headers.t ->
···
< clock: 'clock Eio.Resource.t; net: 'net Eio.Resource.t; fs: Eio.Fs.dir_ty Eio.Path.t; .. > ->
+
('clock Eio.Resource.t, 'net Eio.Resource.t) t
(** Create a new requests instance with persistent state and connection pooling.
All resources are bound to the provided switch and will be cleaned up automatically.
···
(** {2 Configuration Management} *)
+
val set_default_header : ('clock, 'net) t -> string -> string -> ('clock, 'net) t
(** Add or update a default header. Returns a new session with the updated header.
The original session's connection pools are shared. *)
+
val remove_default_header : ('clock, 'net) t -> string -> ('clock, 'net) t
(** Remove a default header. Returns a new session without the header. *)
+
val set_auth : ('clock, 'net) t -> Auth.t -> ('clock, 'net) t
(** Set default authentication. Returns a new session with auth configured. *)
+
val clear_auth : ('clock, 'net) t -> ('clock, 'net) t
(** Clear authentication. Returns a new session without auth. *)
+
val set_timeout : ('clock, 'net) t -> Timeout.t -> ('clock, 'net) t
(** Set default timeout. Returns a new session with the timeout configured. *)
+
val set_retry : ('clock, 'net) t -> Retry.config -> ('clock, 'net) t
(** Set retry configuration. Returns a new session with retry configured. *)
···
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Make a concurrent HTTP request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent GET request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent POST request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent PUT request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent PATCH request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent DELETE request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** Concurrent HEAD request *)
+
(_ Eio.Time.clock, _ Eio.Net.t) t ->
···
(** {2 Cookie Management} *)
+
val cookies : ('clock, 'net) t -> Cookeio.jar
(** Get the cookie jar for direct manipulation *)
+
val clear_cookies : ('clock, 'net) t -> unit
(** {1 Cmdliner Integration} *)
···
user_agent : string option; (** User-Agent header *)
+
val create : config -> < clock: ([> float Eio.Time.clock_ty ] as 'clock) Eio.Resource.t; net: ([> [>`Generic] Eio.Net.ty ] as 'net) Eio.Resource.t; fs: Eio.Fs.dir_ty Eio.Path.t; .. > -> Eio.Switch.t -> ('clock Eio.Resource.t, 'net Eio.Resource.t) t
(** [create config env sw] creates a requests instance from command-line configuration *)
(** {2 Individual Terms} *)
···
+
val requests_term : string -> < clock: ([> float Eio.Time.clock_ty ] as 'clock) Eio.Resource.t; net: ([> [>`Generic] Eio.Net.ty ] as 'net) Eio.Resource.t; fs: Eio.Fs.dir_ty Eio.Path.t; .. > -> Eio.Switch.t -> ('clock Eio.Resource.t, 'net Eio.Resource.t) t Cmdliner.Term.t
(** [requests_term app_name env sw] creates a term that directly produces a requests instance.
This is a convenience function that combines configuration parsing