pub struct MockRequest { /* private fields */ }
Expand description
A mock request type
Implementations§
Source§impl MockRequest
impl MockRequest
Sourcepub fn headers(&self) -> impl IntoIterator<Item = (&HeaderName, &HeaderValue)>
pub fn headers(&self) -> impl IntoIterator<Item = (&HeaderName, &HeaderValue)>
Returns the headers used by this mock request
Sourcepub fn with_header(self, name: &str, value: &str) -> Self
pub fn with_header(self, name: &str, value: &str) -> Self
Convenience method for setting a header
Trait Implementations§
Source§impl ClientRequestLike for MockRequest
impl ClientRequestLike for MockRequest
Source§fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>
fn compute_digest(&mut self, digest: &dyn HttpDigest) -> Option<String>
Compute the digest using the provided HTTP digest algorithm. If this is not possible,
then return
None
. This may require buffering the request data into memory.Source§fn set_header(&mut self, header: HeaderName, value: HeaderValue)
fn set_header(&mut self, header: HeaderName, value: HeaderValue)
Add a header to the request. This function may be used to set the
Date
and Digest
headers if not already present depending on the configuration. The Authorization
header will always be set assuming the message was signed successfully.Source§fn host(&self) -> Option<String>
fn host(&self) -> Option<String>
Returns the host for the request (eg. “example.com”, “127.0.0.1:8080”) in case the Host header has
not been set explicitly. Note, the correct form of the
Host
header is <host>:<port>
if
the port is non-standard for the protocol used (e.g., 443 for an HTTPS URL, and 80 for an HTTP URL).
When implementing this trait, do not just read the Host
header from the request -
this method will only be called when the Host
header is not set.Source§impl Clone for MockRequest
impl Clone for MockRequest
Source§fn clone(&self) -> MockRequest
fn clone(&self) -> MockRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MockRequest
impl Debug for MockRequest
Source§impl PartialEq for MockRequest
impl PartialEq for MockRequest
Source§impl RequestLike for MockRequest
impl RequestLike for MockRequest
Source§fn header(&self, header: &Header) -> Option<HeaderValue>
fn header(&self, header: &Header) -> Option<HeaderValue>
Returns an existing header on the request. This method must reflect changes made
be the
ClientRequestLike::set_header
method, with the possible exception of the
Authorization
header itself.Source§fn has_header(&self, header: &Header) -> bool
fn has_header(&self, header: &Header) -> bool
Returns true if this request contains a value for the specified header. If this
returns true, following requests to
header()
for the same name must return a
value.Source§impl ServerRequestLike for &MockRequest
impl ServerRequestLike for &MockRequest
Source§type Remnant = ()
type Remnant = ()
For some request types, the verification process may be a destructive operation.
This associated type can be used to return information that might otherwise
be lost.
Source§fn complete_with_digest(
self,
digest: &dyn HttpDigest,
) -> (Option<String>, Self::Remnant)
fn complete_with_digest( self, digest: &dyn HttpDigest, ) -> (Option<String>, Self::Remnant)
Complete the verification process, indicating that we want to compute a digest of the
request body. This may require buffering the whole request body into memory. Read more
impl StructuralPartialEq for MockRequest
Auto Trait Implementations§
impl Freeze for MockRequest
impl RefUnwindSafe for MockRequest
impl Send for MockRequest
impl Sync for MockRequest
impl Unpin for MockRequest
impl UnwindSafe for MockRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CanonicalizeExt for Twhere
T: RequestLike,
impl<T> CanonicalizeExt for Twhere
T: RequestLike,
Source§fn canonicalize(
&self,
config: &CanonicalizeConfig,
) -> Result<SignatureString, CanonicalizeError>
fn canonicalize( &self, config: &CanonicalizeConfig, ) -> Result<SignatureString, CanonicalizeError>
Compute the canonical representation of this request
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<R> SigningExt for Rwhere
R: ClientRequestLike,
impl<R> SigningExt for Rwhere
R: ClientRequestLike,
Source§fn sign(&mut self, config: &SigningConfig) -> Result<(), SigningError>
fn sign(&mut self, config: &SigningConfig) -> Result<(), SigningError>
Signs the request in-place according to the provided configuration.
Source§fn signed(self, config: &SigningConfig) -> Result<Self, SigningError>
fn signed(self, config: &SigningConfig) -> Result<Self, SigningError>
Consumes the request and returns it signed according to the provided configuration.