pub struct TestServer { /* private fields */ }Expand description
Test server controller
Implementations§
Source§impl TestServer
impl TestServer
Sourcepub fn create(
id: Uuid,
system: System,
server: Server,
addr: SocketAddr,
timeout: Seconds,
connect_timeout: Millis,
) -> Self
pub fn create( id: Uuid, system: System, server: Server, addr: SocketAddr, timeout: Seconds, connect_timeout: Millis, ) -> Self
Creates a test-server controller from a running server and its client connection settings.
Sourcepub fn set_client_timeout(
self,
timeout: Seconds,
connect_timeout: Millis,
) -> Self
pub fn set_client_timeout( self, timeout: Seconds, connect_timeout: Millis, ) -> Self
Sets the client timeouts.
timeout controls the TLS handshake, response-header and response
payload timeouts, while connect_timeout controls how long the client
waits to establish a connection. By default the response timeouts are
30 seconds.
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
Returns the test server’s socket address.
Sourcepub fn request<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
pub fn request<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
Create client request
Sourcepub fn srequest<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
pub fn srequest<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
Create secure client request
Sourcepub async fn load_body(
&self,
response: ClientResponse,
) -> Result<Bytes, Error<ClientPayloadError>>
pub async fn load_body( &self, response: ClientResponse, ) -> Result<Bytes, Error<ClientPayloadError>>
Load response’s body
Sourcepub async fn ws(
&self,
) -> Result<WsConnection<impl Filter>, Error<WsClientError>>
pub async fn ws( &self, ) -> Result<WsConnection<impl Filter>, Error<WsClientError>>
Connect to a websocket server
Sourcepub async fn ws_at(
&self,
path: &str,
) -> Result<WsConnection<impl Filter>, Error<WsClientError>>
pub async fn ws_at( &self, path: &str, ) -> Result<WsConnection<impl Filter>, Error<WsClientError>>
Connect to websocket server at a given path
Sourcepub async fn wss(
&self,
) -> Result<WsConnection<Layer<SslFilter>>, Error<WsClientError>>
pub async fn wss( &self, ) -> Result<WsConnection<Layer<SslFilter>>, Error<WsClientError>>
Connect to a websocket server
Sourcepub async fn wss_at(
&self,
path: &str,
) -> Result<WsConnection<Layer<SslFilter>>, Error<WsClientError>>
pub async fn wss_at( &self, path: &str, ) -> Result<WsConnection<Layer<SslFilter>>, Error<WsClientError>>
Connect to secure websocket server at a given path
Trait Implementations§
Source§impl Debug for TestServer
impl Debug for TestServer
Source§impl Drop for TestServer
impl Drop for TestServer
Auto Trait Implementations§
impl !Freeze for TestServer
impl !RefUnwindSafe for TestServer
impl !Send for TestServer
impl !Sync for TestServer
impl !UnwindSafe for TestServer
impl Unpin for TestServer
impl UnsafeUnpin for TestServer
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