Skip to main content

Crate roas_http_fetcher

Crate roas_http_fetcher 

Source
Expand description

HTTP/HTTPS ResourceFetcher / AsyncResourceFetcher for the roas OpenAPI loader.

The generic Fetcher<C> is parameterised over the underlying reqwest client type. Two concrete aliases cover the common cases:

Both forms are Clone so a single fetcher can be registered for both http:// and https:// prefixes, sharing one underlying connection pool. Transport failures, non-2xx responses, and unreadable bodies are surfaced through LoaderError::Fetch with a HttpFetchError source. Schemes other than http / https are rejected with LoaderError::UnsupportedFetcherUri.

With the yaml feature enabled, both forms parse YAML response bodies in addition to JSON. Format selection sniffs the response Content-Type header first and falls back to the URL path extension (.yaml / .yml).

Structs§

Fetcher
HTTP/HTTPS fetcher generic over the underlying reqwest client.

Enums§

HttpFetchError
Transport-layer failure exposed by HttpFetcher.

Type Aliases§

AsyncHttpFetcher
Async HTTP/HTTPS fetcher, suitable for Loader::register_async_fetcher. A tokio runtime must be active when the returned future is awaited.
HttpFetcher
Blocking HTTP/HTTPS fetcher, suitable for Loader::register_fetcher.