pub struct Request {
pub url: Url,
pub method: Method,
pub headers: HeaderMap,
pub body: Vec<u8>,
}
Expand description
An incoming request to an instance of MockServer
.
Each matcher gets an immutable reference to a Request
instance in the matches
method
defined in the Match
trait.
§Implementation notes:
We can’t use http_types::Request
directly in our Match::matches
signature:
it requires having mutable access to the request to extract the body (which gets
consumed when read!).
It would also require matches
to be async, which is cumbersome due to the lack of async traits.
We introduce our Request
type to perform this extraction once when the request
arrives in the mock serve, store the result and pass an immutable reference to it
to all our matchers.
Fields§
§url: Url
§method: Method
§headers: HeaderMap
§body: Vec<u8>
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)