pub struct HttpResponse<B> { /* private fields */ }Expand description
A mocked HTTP outcall response.
The type parameter B determines what kind of body is returned:
Valuefor single JSON-RPC responses (seeJsonRpcResponse)Vec<Value>for batch JSON-RPC responses (seeBatchJsonRpcResponse)
Implementations§
Source§impl HttpResponse<Value>
impl HttpResponse<Value>
Sourcepub fn with_id(self, id: u64) -> Self
pub fn with_id(self, id: u64) -> Self
Mutates the response to set the given JSON-RPC response ID to a ConstantSizeId with the
given value.
Sourcepub fn with_raw_id(self, id: Id) -> Self
pub fn with_raw_id(self, id: Id) -> Self
Mutates the response to set the given JSON-RPC response ID to the given Id.
Trait Implementations§
Source§impl<B: Clone> Clone for HttpResponse<B>
impl<B: Clone> Clone for HttpResponse<B>
Source§fn clone(&self) -> HttpResponse<B>
fn clone(&self) -> HttpResponse<B>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<B: Serialize> From<HttpResponse<B>> for CanisterHttpResponse
impl<B: Serialize> From<HttpResponse<B>> for CanisterHttpResponse
Source§fn from(response: HttpResponse<B>) -> Self
fn from(response: HttpResponse<B>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<B> Freeze for HttpResponse<B>where
B: Freeze,
impl<B> RefUnwindSafe for HttpResponse<B>where
B: RefUnwindSafe,
impl<B> Send for HttpResponse<B>where
B: Send,
impl<B> Sync for HttpResponse<B>where
B: Sync,
impl<B> Unpin for HttpResponse<B>where
B: Unpin,
impl<B> UnsafeUnpin for HttpResponse<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for HttpResponse<B>where
B: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more