pub struct MockServer { /* private fields */ }Expand description
A mock server that can be embedded in tests
Implementations§
Source§impl MockServer
impl MockServer
Sourcepub fn new() -> MockServerBuilder
pub fn new() -> MockServerBuilder
Create a new mock server builder
Sourcepub async fn stub_response(
&mut self,
method: impl Into<String>,
path: impl Into<String>,
body: Value,
) -> Result<()>
pub async fn stub_response( &mut self, method: impl Into<String>, path: impl Into<String>, body: Value, ) -> Result<()>
Stub a response for a given method and path
Sourcepub async fn add_stub(&mut self, stub: ResponseStub) -> Result<()>
pub async fn add_stub(&mut self, stub: ResponseStub) -> Result<()>
Add a response stub
Sourcepub async fn clear_stubs(&mut self) -> Result<()>
pub async fn clear_stubs(&mut self) -> Result<()>
Remove all stubs
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the server is running
Trait Implementations§
Source§impl Debug for MockServer
impl Debug for MockServer
Source§impl Default for MockServer
impl Default for MockServer
Auto Trait Implementations§
impl Freeze for MockServer
impl !RefUnwindSafe for MockServer
impl Send for MockServer
impl Sync for MockServer
impl Unpin for MockServer
impl !UnwindSafe for MockServer
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