Skip to main content

Module http

Module http 

Source
Expand description

The one place HTTP requests are made and errors mapped. Shared HTTP plumbing: one pooled [reqwest::Client] per server, one place that maps transport and status-code failures to GotifyError.

GotifyClient’s every method calls request_json with the same borrowed Client rather than each building their own — a fresh reqwest::Client per call defeats connection pooling and keep-alive under load, so build one with build_client and reuse it for the client’s lifetime.

Functions§

build_client
Builds the pooled HTTP client used for every request against one server.
request_json
Issues one request against base_url using the caller-supplied client, and maps the transport/status outcome into a Result.