pub struct MockHttpClient(/* private fields */);Expand description
A client that answers what the test configured. A request for a URL with no answer fails as a connection that found nothing.
Implementations§
Source§impl MockHttpClient
impl MockHttpClient
pub fn new() -> MockHttpClient
Sourcepub fn answering(
self,
url: impl Into<String>,
response: MockResponse,
) -> MockHttpClient
pub fn answering( self, url: impl Into<String>, response: MockResponse, ) -> MockHttpClient
Answers every request for url with response. The last answer for a URL is the one
used.
Sourcepub fn asked(&self) -> Vec<SentRequest>
pub fn asked(&self) -> Vec<SentRequest>
Every request the client was given, in order.
Trait Implementations§
Source§impl Clone for MockHttpClient
impl Clone for MockHttpClient
Source§impl Default for MockHttpClient
impl Default for MockHttpClient
Source§impl HttpClient for MockHttpClient
impl HttpClient for MockHttpClient
Source§fn send(&self, request: Request<Body>, options: SendOptions) -> HttpFuture
fn send(&self, request: Request<Body>, options: SendOptions) -> HttpFuture
Sends
request. The answer arrives once the response’s head has, with its body still to
read; dropping the future before then cancels the request. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for MockHttpClient
impl !Send for MockHttpClient
impl !Sync for MockHttpClient
impl !UnwindSafe for MockHttpClient
impl Forget for MockHttpClient
impl Freeze for MockHttpClient
impl Move for MockHttpClient
impl Unpin for MockHttpClient
impl UnsafeUnpin for MockHttpClientwhere
*const RcInner<ClientState> is !null: UnsafeUnpin,
PhantomData<RcInner<ClientState>>: UnsafeUnpin,
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