fn index_gets_trailing_slash(tmpdir: TempDir, port: u16) -> Result<(), Error> {
    let mut child = Command::cargo_bin("miniserve")?
        .arg("-p")
        .arg(port.to_string())
        .arg(tmpdir.path())
        .stdout(Stdio::null())
        .spawn()?;

    sleep(Duration::from_secs(1));

    let base_url = Url::parse(&format!("http://localhost:{}", port))?;
    let expected_url = format!("{}", base_url);
    let resp = reqwest::blocking::get(base_url.as_str())?;
    assert_eq!(resp.url().as_str(), expected_url);

    child.kill()?;

    Ok(())
}
/// The index directory gets a trailing slash.
The index directory gets a trailing slash.
The index directory gets a trailing slash .
fn index_gets_trailing_slash(tmpdir: TempDir, port: u16) -> Result<(), Error> {
    let mut child = Command::cargo_bin("miniserve")?
        .arg("-p")
        .arg(port.to_string())
        .arg(tmpdir.path())
        .stdout(Stdio::null())
        .spawn()?;
    sleep(Duration::from_secs(1));
    let base_url = Url::parse(&format!("http://localhost:{}", port))?;
    let expected_url = format!("{}", base_url);
    let resp = reqwest::blocking::get(base_url.as_str())?;
    assert_eq!(resp.url().as_str(), expected_url);
    child.kill()?;
    Ok(())
}
fn index_gets_trailing_slash ( tmpdir : TempDir , port : u16 ) -> Result < ( ) , Error > { let mut child = Command :: cargo_bin ( " " ) ? . arg ( " " ) . arg ( port . to_string ( ) ) . arg ( tmpdir . path ( ) ) . stdout ( Stdio :: null ( ) ) . spawn ( ) ? ; sleep ( Duration :: from_secs ( 1 ) ) ; let base_url = Url :: parse ( & format ! ( " " port ) ) ? ; let expected_url = format ! ( " " base_url ) ; let resp = reqwest :: blocking :: get ( base_url . as_str ( ) ) ? ; assert_eq ! ( resp url ( ) as_str ( ) expected_url ) ; child . kill ( ) ? ; Ok ( ( ) ) }
The index directory gets a trailing slash.
The index directory gets a trailing slash .
tmpdir
TempDir
port
u16
tmpdir
TempDir
port
u16