Skip to main content

SigningRequest

Struct SigningRequest 

Source
pub struct SigningRequest {
    pub method: Method,
    pub scheme: Scheme,
    pub authority: Authority,
    pub path: String,
    pub query: Vec<(String, String)>,
    pub headers: HeaderMap,
}
Expand description

Signing context for request.

Fields§

§method: Method

HTTP method.

§scheme: Scheme

HTTP scheme.

§authority: Authority

HTTP authority.

§path: String

HTTP path.

§query: Vec<(String, String)>

HTTP query parameters.

§headers: HeaderMap

HTTP headers.

Implementations§

Source§

impl SigningRequest

Source

pub fn build(parts: &mut Parts) -> Result<Self>

Build a signing context from http::request::Parts.

Source

pub fn apply(self, parts: &mut Parts) -> Result<()>

Apply the signing context back to http::request::Parts.

Source

pub fn path_percent_decoded(&self) -> Cow<'_, str>

Get the path percent decoded.

Source

pub fn query_size(&self) -> usize

Get query size.

Source

pub fn query_push(&mut self, key: impl Into<String>, value: impl Into<String>)

Push a new query pair into query list.

Source

pub fn query_append(&mut self, query: &str)

Push a query string into query list.

Source

pub fn query_to_vec_with_filter( &self, filter: impl Fn(&str) -> bool, ) -> Vec<(String, String)>

Get query value by filter.

Source

pub fn query_to_string( query: Vec<(String, String)>, sep: &str, join: &str, ) -> String

Convert sorted query to string.

[(a, b), (c, d)] => "a:b\nc:d"
Source

pub fn query_to_percent_decoded_string( query: Vec<(String, String)>, sep: &str, join: &str, ) -> String

Convert sorted query to percent decoded string.

[(a, b), (c, d)] => "a:b\nc:d"
Source

pub fn header_get_or_default(&self, key: &HeaderName) -> Result<&str>

Get header value by name.

Returns empty string if header not found.

Source

pub fn header_value_normalize(v: &mut HeaderValue)

Normalize header value.

Source

pub fn header_name_to_vec_sorted(&self) -> Vec<&str>

Get header names as sorted vector.

Source

pub fn header_to_vec_with_prefix(&self, prefix: &str) -> Vec<(String, String)>

Get header names with given prefix.

Source

pub fn header_to_string( headers: Vec<(String, String)>, sep: &str, join: &str, ) -> String

Convert sorted headers to string.

[(a, b), (c, d)] => "a:b\nc:d"

Trait Implementations§

Source§

impl Debug for SigningRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.