Expand description
HTTP client.
This module is a thin wrapper around the isahc crate that just limits the API surface to only
async methods without the async suffix. You can convert from/into that isahc types and this one.
§Examples
Get some text:
let text = task::http::get_txt("https://httpbin.org/base64/SGVsbG8gV29ybGQ=").await?;
println!("{text}!");Modules§
Structs§
- Body
- HTTP request body.
- Cache
Key - Represents a SHA-512/256 hash computed from a normalized request.
- Cache
Policy - Represents a serializable configuration for a cache entry in a
CacheDb. - Client
- HTTP client.
- Client
Builder - Builder that can be used to create a
Client. - Cookie
- Information stored about an HTTP cookie.
- Cookie
Jar - Provides automatic cookie session management using an in-memory cookie store.
- Default
Already Inited Error - Error returned by
set_default_client_initif the default was already initialized. - File
System Cache - A simple
CacheDbimplementation that uses a local directory. - Method
- The Request Method (VERB)
- Metrics
- Information about the state of an HTTP request.
- Request
- HTTP request.
- Request
Builder - A
Requestbuilder. - Response
- HTTP response.
- Status
Code - An HTTP status code (
status-codein RFC 7230 et al.). - Uri
- The URI component of a request.
Enums§
- Cache
Mode - Cache mode selected for a
Uri. - Error
- An error encountered while sending an HTTP request or receiving an HTTP response using a
Client. - Redirect
Policy - Describes a policy for handling server redirects.
Statics§
- METRICS_
ID - Metrics in a
Progress::with_metametadata.
Traits§
- CacheDb
- Represents a download cache in a
Client. - TryBody
- Marker trait for types that try-to-convert to
Body. - TryHeader
Name - Marker trait for types that try-to-convert to
header::HeaderName. - TryHeader
Value - Marker trait for types that try-to-convert to
header::HeaderValue. - TryMethod
- Marker trait for types that try-to-convert to
Method. - TryUri
- Marker trait for types that try-to-convert to
Uri.
Functions§
- default_
client - The
Clientused by the functions in this module. - delete
- Send a DELETE request to the
uri. - get
- Send a GET request to the
uri. - get_
bytes - Send a GET request to the
uriand read the response as raw bytes. - get_
json - Send a GET request to the
uriand de-serializes the response. - get_txt
- Send a GET request to the
uriand read the response as a string. - head
- Send a HEAD request to the
uri. - post
- Send a POST request to the
uriwith a given request body. - put
- Send a PUT request to the
uriwith a given request body. - send
- Send a custom
Request. - set_
default_ client_ init - Set a custom initialization function for the
default_client.
Type Aliases§
- Response
Parts - Head parts from a split
Response.