pub struct MockedEndpoint { /* private fields */ }
Available on
test
and crate feature mock_tests
only.Expand description
A mocked HTTP Endpoint.
It asserts the request body and headers and returns a response
Implementations§
Source§impl MockedEndpoint
impl MockedEndpoint
pub fn new(res_code: u16) -> Self
pub fn assert_body<B: Into<BodyMock>>(&mut self, body: B)
pub fn set_response<B: Into<BodyMock>>(&mut self, code: u16, body: B)
pub fn set_response_status(&mut self, code: u16)
Sourcepub fn add_response_header<N, V, E1, E2>(
&mut self,
name: N,
value: V,
) -> Result<(), ErrorImp>where
N: TryInto<HeaderName, Error = E1>,
V: TryInto<HeaderValue, Error = E2>,
ErrorImp: From<E1> + From<E2>,
pub fn add_response_header<N, V, E1, E2>(
&mut self,
name: N,
value: V,
) -> Result<(), ErrorImp>where
N: TryInto<HeaderName, Error = E1>,
V: TryInto<HeaderValue, Error = E2>,
ErrorImp: From<E1> + From<E2>,
Add a single header to the response If the map did have this key present, the new value is pushed to the end of the list of values
Sourcepub fn add_header_assertion<N, V, E1, E2>(
&mut self,
name: N,
value: V,
) -> Result<(), ErrorImp>where
N: TryInto<HeaderName, Error = E1>,
V: TryInto<HeaderValue, Error = E2>,
ErrorImp: From<E1> + From<E2>,
pub fn add_header_assertion<N, V, E1, E2>(
&mut self,
name: N,
value: V,
) -> Result<(), ErrorImp>where
N: TryInto<HeaderName, Error = E1>,
V: TryInto<HeaderValue, Error = E2>,
ErrorImp: From<E1> + From<E2>,
Check a single header of the request If the map did have this key present, the new value is pushed to the end of the list of values
Auto Trait Implementations§
impl Freeze for MockedEndpoint
impl RefUnwindSafe for MockedEndpoint
impl Send for MockedEndpoint
impl Sync for MockedEndpoint
impl Unpin for MockedEndpoint
impl UnwindSafe for MockedEndpoint
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