Crate canhttp

Source
Expand description

Library to make HTTPs outcalls from a canister on the Internet Computer, leveraging the modularity of the tower framework.

Re-exports§

pub use convert::ConvertServiceBuilder;

Modules§

convert
Fallible conversion from one type to another that can be used as a tower middleware.
http
Middleware to add an HTTP translation layer.
observability
Middleware that adds high level observability (e.g., logging, metrics) to a Service.
retry
Middleware for retrying “failed” requests.

Structs§

Client
Thin wrapper around ic_cdk::api::management_canister::http_request::http_request that implements the tower::Service trait. Its functionality can be extended by composing so-called tower middlewares.
CyclesAccounting
A middleware to handle cycles accounting, i.e. verify if sufficiently many cycles are available in a request. How cycles are estimated is given by CyclesEstimator
CyclesCostEstimator
Estimate the exact minimum cycles amount required to send an HTTPs outcall as specified here.
IcError
Error returned by the Internet Computer when making an HTTPs outcall.
IcHttpRequestWithCycles
IcHttpRequest specifying how many cycles should be attached for the HTTPs outcall.

Enums§

CyclesAccountingError
Error return by the CyclesAccounting middleware.

Traits§

CyclesChargingPolicy
Estimate the amount of cycles to charge for a single HTTPs outcall.
HttpsOutcallError
Characterize errors that are specific to HTTPs outcalls.
MaxResponseBytesRequestExtension
Add support for max response bytes.
TransformContextRequestExtension
Add support for transform context to specify how the response will be canonicalized by the replica to maximize chances of consensus.