Struct actix_http_test::TestServer
source · pub struct TestServer { /* private fields */ }
Expand description
Test server controller
Implementations§
source§impl TestServer
impl TestServer
sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
Construct test server url
sourcepub fn request<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
pub fn request<S: AsRef<str>>(&self, method: Method, path: S) -> ClientRequest
Connect to test HTTP server
pub async fn load_body<S>( &mut self, response: ClientResponse<S> ) -> Result<Bytes, PayloadError>
sourcepub async fn ws_at(
&mut self,
path: &str
) -> Result<Framed<impl AsyncRead + AsyncWrite, Codec>, WsClientError>
pub async fn ws_at( &mut self, path: &str ) -> Result<Framed<impl AsyncRead + AsyncWrite, Codec>, WsClientError>
Connect to WebSocket server at a given path.
sourcepub async fn ws(
&mut self
) -> Result<Framed<impl AsyncRead + AsyncWrite, Codec>, WsClientError>
pub async fn ws( &mut self ) -> Result<Framed<impl AsyncRead + AsyncWrite, Codec>, WsClientError>
Connect to a WebSocket server.
sourcepub fn client_headers(&mut self) -> Option<&mut HeaderMap>
pub fn client_headers(&mut self) -> Option<&mut HeaderMap>
Get default HeaderMap of Client.
Returns Some(&mut HeaderMap) when Client object is unique (No other clone of client exists at the same time).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestServer
impl !RefUnwindSafe for TestServer
impl !Send for TestServer
impl !Sync for TestServer
impl Unpin for TestServer
impl !UnwindSafe 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