refactor: migrate to axum 0.7
This commit is contained in:
parent
57704def31
commit
e1e544267d
5 changed files with 159 additions and 43 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use std::net::{SocketAddr, TcpListener};
|
||||
use std::net::SocketAddr;
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
struct TestApp {
|
||||
addr: SocketAddr,
|
||||
|
|
@ -74,9 +75,10 @@ async fn subscribe_returns_a_400_when_data_is_missing() {
|
|||
}
|
||||
|
||||
async fn spawn_app() -> TestApp {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind to random port");
|
||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let addr = listener.local_addr().unwrap();
|
||||
let server = learn_axum::run(listener).expect("Failed to bind to address");
|
||||
tokio::spawn(server);
|
||||
tokio::spawn(async move {
|
||||
axum::serve(listener, learn_axum::app()).await.unwrap();
|
||||
});
|
||||
TestApp { addr }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue