1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Utilities for testing application.
//!
//! # Example
//!
//! ```no_run
//! use salvo_core::prelude::*;
//!
//! #[handler]
//! async fn hello() -> &'static str {
//! "Hello"
//! }
//!
//! fn route() -> Router {
//! Router::new().goal(hello)
//! }
//!
//! #[tokio::main]
//! async fn main() {
//! let acceptor = TcpListener::new("0.0.0.0:8698").bind().await;
//! Server::new(acceptor).serve(route()).await;
//! }
//!
//! #[cfg(test)]
//! mod tests {
//! use salvo_core::prelude::*;
//! use salvo_core::test::{ResponseExt, TestClient};
//!
//! #[tokio::test]
//! async fn test_hello() {
//! let service = Service::new(super::route());
//!
//! let content = TestClient::get("http://0.0.0.0:8698/")
//! .send(&service)
//! .await
//! .take_string()
//! .await
//! .unwrap();
//! assert!(content.contains("Hello"));
//! }
//! }
//! ```
pub use TestClient;
pub use ;
pub use ResponseExt;