Struct aws_smithy_runtime::client::http::test_util::wire::WireMockServer
source · pub struct WireMockServer { /* private fields */ }
Available on crate features
client
and test-util
and connector-hyper-0-14-x
and wire-mock
only.Expand description
Test server that binds to 127.0.0.1:0
See the module docs for a usage example.
Usage:
- Call
WireMockServer::start
to start the server - Use
WireMockServer::http_client
ordns_resolver
to configure your client. - Make requests to
endpoint_url
. - Once the test is complete, retrieve a list of events from
WireMockServer::events
Implementations§
source§impl WireMockServer
impl WireMockServer
sourcepub async fn start(response_events: Vec<ReplayedEvent>) -> Self
pub async fn start(response_events: Vec<ReplayedEvent>) -> Self
Start a wire mock server with the given events to replay.
sourcepub fn events(&self) -> Vec<RecordedEvent>
pub fn events(&self) -> Vec<RecordedEvent>
Retrieve the events recorded by this connection
pub fn dns_resolver(&self) -> LoggingDnsResolver
sourcepub fn http_client(&self) -> SharedHttpClient
pub fn http_client(&self) -> SharedHttpClient
Prebuilt HttpClient
with correctly wired DNS resolver.
Note: This must be used in tandem with Self::dns_resolver
sourcepub fn endpoint_url(&self) -> String
pub fn endpoint_url(&self) -> String
Endpoint to use when connecting
This works in tandem with the Self::dns_resolver
to bind to the correct local IP Address
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WireMockServer
impl !RefUnwindSafe for WireMockServer
impl Send for WireMockServer
impl Sync for WireMockServer
impl Unpin for WireMockServer
impl !UnwindSafe for WireMockServer
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> 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>
Creates a shared type from an unshared type.