Crate hypertyper

Crate hypertyper 

Source
Expand description

Useful types and idioms (and a few implementations) for building HTTP/S clients.

Hypertyper provides convenient ways to build and use HTTP/S clients. Configure an HTTPClientFactory once and use it to produce as many HTTPClient instances as needed. Use HTTPResult to provide a common way to return HTTP response bodies or errors, and wrap HTTP errors in a common HTTPError enum to unify your HTTP response handling.

Under the hood, Hypertyper uses the excellent reqwest library to satisfy all your HTTP needs.

§Usage

With HTTPClientFactory, you can configure a factory once and use it to produce identical HTTP clients as needed. For example, you configure set a user agent when you create the factory, and any HTTP clients created by that factory will automatically use that user agent string when making HTTP calls.

You can also define your own calls to return a common HTTPResult, and wrap errors using the HTTPError enum.

§History

Hypertyper was created to wrap the most common HTTP-related code into a common interface usable across libraries and applications. It is a rapidly-evolving project that will grow to encapsulate the most common HTTP types, idioms, and operations, allowing you to focus on the specific needs of your applications.

Re-exports§

pub use crate::auth::Auth;
pub use crate::service::HTTPGet;
pub use crate::service::HTTPPost;
pub use crate::service::HTTPService;

Modules§

auth
HTTP authentication.
service
Traits and structs for communicating with HTTP servers.

Structs§

HTTPClientFactory
Produces new HTTP clients from a template.

Enums§

HTTPError
Indicates an error has occurred when making an HTTP call.

Traits§

IntoUrl
A trait to try to convert some type into a Url.

Type Aliases§

HTTPClient
An HTTP client created by an HTTPClientFactory.
HTTPResult
The result of an HTTP request.