Struct poem::test::TestClient
source[−]pub struct TestClient<E = BoxEndpoint<'static, Response>> { /* private fields */ }
This is supported on crate feature
test
only.Expand description
A client for testing.
Examples
use poem::{handler, test::TestClient, Route};
#[handler]
fn index() {}
let app = Route::new().at("/", index);
let cli = TestClient::new(index);
cli.get("/").send().await.assert_status_is_ok();
Implementations
pub fn default_header<K, V>(self, key: K, value: V) -> Self where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
pub fn default_header<K, V>(self, key: K, value: V) -> Self where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Sets the default header for each requests.
Sets the default content type for each requests.
Create a GET
request.
Create a POST
request.
Create a PUT
request.
Create a DELETE
request.
Create a HEAD
request.
Create a OPTIONS
request.
Create a CONNECT
request.
Create a PATCH
request.
Create a TRACE
request.
Auto Trait Implementations
impl<E> RefUnwindSafe for TestClient<E> where
E: RefUnwindSafe,
impl<E> Send for TestClient<E> where
E: Send,
impl<E> Sync for TestClient<E> where
E: Sync,
impl<E> Unpin for TestClient<E> where
E: Unpin,
impl<E> UnwindSafe for TestClient<E> where
E: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more