pub enum MockHttpResponse {
Success(Bytes),
Error(StatusCode, String),
ErrorResponse(StatusCode, Bytes),
}Available on crate features
test-utils only.Expand description
Response scripted for RecordingHttpClient.
Variants§
Success(Bytes)
Return this body with a successful HTTP status.
Error(StatusCode, String)
Return a status-code error with the given body text.
ErrorResponse(StatusCode, Bytes)
Return an HTTP response with the given (typically non-success) status and body, instead of a transport-level error.
Implementations§
Source§impl MockHttpResponse
impl MockHttpResponse
Sourcepub fn success(body: impl Into<Bytes>) -> MockHttpResponse
pub fn success(body: impl Into<Bytes>) -> MockHttpResponse
Create a successful response from bytes.
Sourcepub fn error(status: StatusCode, message: impl Into<String>) -> MockHttpResponse
pub fn error(status: StatusCode, message: impl Into<String>) -> MockHttpResponse
Create an error response with a status code and message.
Trait Implementations§
Source§impl Clone for MockHttpResponse
impl Clone for MockHttpResponse
Source§fn clone(&self) -> MockHttpResponse
fn clone(&self) -> MockHttpResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockHttpResponse
impl Debug for MockHttpResponse
Source§impl Default for MockHttpResponse
impl Default for MockHttpResponse
Source§fn default() -> MockHttpResponse
fn default() -> MockHttpResponse
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MockHttpResponse
impl RefUnwindSafe for MockHttpResponse
impl Send for MockHttpResponse
impl Sync for MockHttpResponse
impl Unpin for MockHttpResponse
impl UnsafeUnpin for MockHttpResponse
impl UnwindSafe for MockHttpResponse
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