()
| 85 | |
| 86 | #[tokio::test] |
| 87 | async fn request_test() { |
| 88 | let mut server = mockito::Server::new_async().await; |
| 89 | let mock = server |
| 90 | .mock("GET", "/hello") |
| 91 | .with_status(200) |
| 92 | .with_header("content-type", "text/plain") |
| 93 | .with_body("world") |
| 94 | .create(); |
| 95 | let url = server.url(); |
| 96 | |
| 97 | let client = new_client().unwrap(); |
| 98 | let res = client.get(format!("{url}/hello")).send().await.unwrap(); |
| 99 | assert_eq!(res.status(), 200); |
| 100 | assert_eq!(res.headers()["content-type"], "text/plain"); |
| 101 | assert_eq!(res.text().await.unwrap(), "world"); |
| 102 | |
| 103 | mock.expect(1).assert(); |
| 104 | } |
| 105 | } |
nothing calls this directly
no test coverage detected