nucleus-http 0.15.1

Web Framework/Server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod common;
use common::*;

#[tokio::test]
async fn file_get() {
    let tcp_port = launch_dev_server().await;
    let url = format!("http://localhost:{}/", tcp_port);
    let client_builder = reqwest::ClientBuilder::new();
    let client = client_builder.build().unwrap();
    let res = client.get(&url).send().await.unwrap();
    dbg!(&res);
    let index_string = include_str!("../index.html");
    assert_eq!(url, res.url().to_string());
    assert_eq!(reqwest::StatusCode::from_u16(200).unwrap(), res.status());
    assert_eq!(index_string, res.text().await.unwrap());
}