pub struct MockHttp { /* private fields */ }Expand description
Implementations§
Source§impl MockHttp
impl MockHttp
Sourcepub fn builder() -> MockHttpBuilder
pub fn builder() -> MockHttpBuilder
Create a builder.
Sourcepub fn add_mock_sync<F>(&self, pattern: &str, handler: F)
pub fn add_mock_sync<F>(&self, pattern: &str, handler: F)
Add a mock handler (sync version for use in builders).
Sourcepub fn add_mock_boxed(&mut self, pattern: &str, handler: BoxedHandler)
pub fn add_mock_boxed(&mut self, pattern: &str, handler: BoxedHandler)
Add a mock handler from a boxed closure.
Sourcepub async fn execute(&self, request: MockRequest) -> MockResponse
pub async fn execute(&self, request: MockRequest) -> MockResponse
Execute a mock request.
Sourcepub fn requests(&self) -> Vec<RecordedRequest>
pub fn requests(&self) -> Vec<RecordedRequest>
Get recorded requests.
Sourcepub fn requests_blocking(&self) -> Vec<RecordedRequest>
pub fn requests_blocking(&self) -> Vec<RecordedRequest>
Get recorded requests (blocking version for use in sync contexts).
Sourcepub fn requests_to(&self, pattern: &str) -> Vec<RecordedRequest>
pub fn requests_to(&self, pattern: &str) -> Vec<RecordedRequest>
Get requests matching a pattern.
Sourcepub fn clear_requests(&self)
pub fn clear_requests(&self)
Clear recorded requests.
Sourcepub fn clear_mocks(&self)
pub fn clear_mocks(&self)
Clear all mocks.
Sourcepub fn assert_called(&self, pattern: &str)
pub fn assert_called(&self, pattern: &str)
Assert that a URL pattern was called.
Sourcepub fn assert_called_times(&self, pattern: &str, expected: usize)
pub fn assert_called_times(&self, pattern: &str, expected: usize)
Assert that a URL pattern was called a specific number of times.
Sourcepub fn assert_not_called(&self, pattern: &str)
pub fn assert_not_called(&self, pattern: &str)
Assert that a URL pattern was not called.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockHttp
impl RefUnwindSafe for MockHttp
impl Send for MockHttp
impl Sync for MockHttp
impl Unpin for MockHttp
impl UnwindSafe for MockHttp
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§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 more