salvo-rs / salvo

A powerful web framework built with a simplified design.
https://salvo.rs
Apache License 2.0
3.26k stars 197 forks source link

路由不存在时http状态码为啥是200而不是404 ? #917

Closed micross closed 1 day ago

micross commented 1 day ago

版本 0.72.1,用一下代码可测试:

use salvo::prelude::*;

#[handler]
async fn hello() -> &'static str {
    "Hello World"
}

#[tokio::main]
async fn main() {
    tracing_subscriber::fmt().init();

    let router = Router::new().get(hello);
    let acceptor = TcpListener::new("127.0.0.1:5800").bind().await;
    Server::new(acceptor).serve(router).await;
}

20240919232307

chrislearn commented 1 day ago

已经修复,版本 0.72.2