Expand description
Useful types and idioms 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.
The easiest way to import the most commonly-used Hypertyper traits and
data structures is through hypertyper::prelude:
use hypertyper::prelude::*;§Features
- test-utils -
Includes features that are useful for testing HTTP functionality, such as
the
HttpTestService.
§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.
Modules§
- auth
- HTTP authentication.
- prelude
- Convenience module for the most common Hypertyper imports.
- service
- Traits and structs for communicating with HTTP servers.
Macros§
- http_
factory - Creates a new
HttpClientFactorywith a standardized user agent string.
Structs§
- Http
Client - An asynchronous
Clientto make Requests with. - Http
Client Factory - Produces new HTTP clients from a template.
Enums§
- Http
Error - Indicates an error has occurred when making an HTTP call.
Type Aliases§
- Http
Result - The result of an HTTP request.