Expand description
HTTP client.
This module provides an HTTP client API that is backend agnostic. By default it uses the system curl command
line utility with a simple cache, this can be replaced by implementing HttpClient and HttpCache.
Modules§
Structs§
- 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
HttpCache. - Curl
Process Client - Basic
HttpClientimplementation that uses thecurlcommand line utility. - File
System Cache - A simple
HttpCacheimplementation that uses a local directory. - Method
- The Request Method (VERB)
- Request
- HTTP request.
- Response
- HTTP response.
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.). - Uri
- The URI component of a request.
Enums§
- Cache
Mode - Request cache mode.
Traits§
- Http
Cache - HTTP cache backend.
- Http
Client - HTTP client backend.
Functions§
- 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. - http_
cache - The
HttpCacheused by the functions in this module. - http_
client - The
HttpClientused by the functions in this module. - 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_
http_ cache - Set a custom initialization function for the
http_client. - set_
http_ client - Set a custom initialization function for the
http_client. - set_
request_ default - Set the default values returned by
Request::new.
Type Aliases§
- Error
- Any error during request or response.