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 get<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn get<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create GET
request
sourcepub fn sget<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn sget<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS GET
request
sourcepub fn post<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn post<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create POST
request
sourcepub fn spost<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn spost<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS POST
request
sourcepub fn head<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn head<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HEAD
request
sourcepub fn shead<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn shead<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS HEAD
request
sourcepub fn put<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn put<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create PUT
request
sourcepub fn sput<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn sput<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS PUT
request
sourcepub fn patch<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn patch<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create PATCH
request
sourcepub fn spatch<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn spatch<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS PATCH
request
sourcepub fn delete<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn delete<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create DELETE
request
sourcepub fn sdelete<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn sdelete<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS DELETE
request
sourcepub fn options<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn options<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create OPTIONS
request
sourcepub fn soptions<S: AsRef<str>>(&self, path: S) -> ClientRequest
pub fn soptions<S: AsRef<str>>(&self, path: S) -> ClientRequest
Create HTTPS OPTIONS
request
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 !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