pub struct RestClientMock { /* private fields */ }Available on crate feature
http only.Expand description
In-memory mock that answers get/post/… from a pre-configured list. See module docs.
Implementations§
Source§impl RestClientMock
impl RestClientMock
pub fn new(base: &str, mocks: Vec<HttpMockItem>) -> Self
pub fn set_server_ca(&mut self, _ca: &str)
pub fn set_mtls(&mut self, _cert: &str, _key: &str)
pub fn headers_reset(&mut self)
pub fn add_header(&mut self, _key: String, _value: String)
pub fn add_header_json(&mut self)
pub fn add_header_bearer(&mut self, _token: &str)
pub fn add_header_basic(&mut self, _username: &str, _password: &str)
pub fn baseurl(&mut self, base: String)
pub fn get(&mut self, path: String) -> RhaiRes<Map>
pub fn head(&mut self, path: String) -> RhaiRes<Map>
pub fn patch(&mut self, path: String, _val: Dynamic) -> RhaiRes<Map>
pub fn put(&mut self, path: String, _val: Dynamic) -> RhaiRes<Map>
pub fn post(&mut self, path: String, _val: Dynamic) -> RhaiRes<Map>
pub fn post_form(&mut self, path: String, _val: Map) -> RhaiRes<Map>
pub fn delete(&mut self, path: String) -> RhaiRes<Map>
pub fn delete_with_body(&mut self, path: String, _val: Dynamic) -> RhaiRes<Map>
Trait Implementations§
Source§impl Clone for RestClientMock
impl Clone for RestClientMock
Source§fn clone(&self) -> RestClientMock
fn clone(&self) -> RestClientMock
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for RestClientMock
impl !UnwindSafe for RestClientMock
impl Freeze for RestClientMock
impl Send for RestClientMock
impl Sync for RestClientMock
impl Unpin for RestClientMock
impl UnsafeUnpin for RestClientMock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Available on crate feature
follow-redirect only.Source§impl<T> Variant for T
impl<T> Variant for T
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant trait object to &mut dyn Any.Source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant trait object to Box<dyn Any>.