Module http

Module http 

Source
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§

header
HTTP header types
method
The HTTP request method
uri
URI component of request and response lines

Structs§

CacheKey
Represents a SHA-512/256 hash computed from a normalized request.
CachePolicy
Represents a serializable configuration for a cache entry in a HttpCache.
CurlProcessClient
Basic HttpClient implementation that uses the curl command line utility.
FileSystemCache
A simple HttpCache implementation that uses a local directory.
Method
The Request Method (VERB)
Request
HTTP request.
Response
HTTP response.
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).
Uri
The URI component of a request.

Enums§

CacheMode
Request cache mode.

Traits§

HttpCache
HTTP cache backend.
HttpClient
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 uri and read the response as raw bytes.
get_json
Send a GET request to the uri and de-serializes the response.
get_txt
Send a GET request to the uri and read the response as a string.
head
Send a HEAD request to the uri.
http_cache
The HttpCache used by the functions in this module.
http_client
The HttpClient used by the functions in this module.
post
Send a POST request to the uri with a given request body.
put
Send a PUT request to the uri with 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.