pub struct MockHttpClient { /* private fields */ }Expand description
Mock HTTP client for testing with pre-recorded responses
Implementations§
Source§impl MockHttpClient
impl MockHttpClient
pub fn new() -> Self
Sourcepub fn with_response(self, url: &str, response: &str) -> Self
pub fn with_response(self, url: &str, response: &str) -> Self
Add a text response for a URL
Sourcepub fn with_binary_response(self, url: &str, response: Vec<u8>) -> Self
pub fn with_binary_response(self, url: &str, response: Vec<u8>) -> Self
Add a binary response for a URL
Sourcepub fn with_file_response(self, url: &str, file_path: &str) -> Self
pub fn with_file_response(self, url: &str, file_path: &str) -> Self
Add a response from a file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockHttpClient
impl RefUnwindSafe for MockHttpClient
impl Send for MockHttpClient
impl Sync for MockHttpClient
impl Unpin for MockHttpClient
impl UnsafeUnpin for MockHttpClient
impl UnwindSafe for MockHttpClient
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