bookclerk_tls::ureq

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

The ureq crate with the hosts' TLS: everything ureq exports, except that the request functions (get, post, …), run and agent use http_agent.

Import it in place of the crate (use bookclerk_tls::ureq;); call sites then read like plain ureq. Build any other agent from Agent::config_builder() with ureq_tls_config, never from Agent::new_with_defaults(), which has no provider.

Item Kind Summary
agent function The shared agent, in place of ureq::agent(), whose fresh default agent has no crypto provider.
run function Sends a prebuilt http::Request on the shared agent, in place of ureq::run, which uses a fresh default agent.
get function Starts a GET request.
post function Starts a POST request.
put function Starts a PUT request.
delete function Starts a DELETE request.
head function Starts a HEAD request.
options function Starts an OPTIONS request.
connect function Starts a CONNECT request.
patch function Starts a PATCH request.
trace function Starts a TRACE request.

Re-exports

Functions

agent

pub fn agent() -> Agent

The shared agent, in place of ureq::agent(), whose fresh default agent has no crypto provider.

Returns

A clone of super::http_agent.

run

pub fn run(request: Request<impl AsSendBody>) -> Result<Response<Body>, Error>

Sends a prebuilt http::Request on the shared agent, in place of ureq::run, which uses a fresh default agent.

Arguments

  • request - The request to send.

Returns

The response.

Errors

Any Error the transfer raises.

get

pub fn get<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a GET request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

post

pub fn post<T>(uri: T) -> RequestBuilder<WithBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a POST request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

put

pub fn put<T>(uri: T) -> RequestBuilder<WithBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a PUT request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

delete

pub fn delete<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a DELETE request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

pub fn head<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a HEAD request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

options

pub fn options<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts an OPTIONS request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

connect

pub fn connect<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a CONNECT request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

patch

pub fn patch<T>(uri: T) -> RequestBuilder<WithBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a PATCH request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

trace

pub fn trace<T>(uri: T) -> RequestBuilder<WithoutBody>
where
    Uri: TryFrom<T>,
    <Uri as TryFrom<T>>::Error: Into<Error>,

Starts a TRACE request.

Arguments

  • uri - The request target, anything that converts to a URI.

Returns

A request builder on the shared agent.

Generated from crates/bookclerk-tls at main · View as Markdown