Skip to main content

guard

Function guard 

Source
pub async fn guard(
    __arg0: State<Arc<Auth>>,
    req: Request<Body>,
    next: Next,
) -> Response
Expand description

全局中间件:除 /health/login 外都要求已登录。

浏览器来的(Accept 含 text/html)跳转到登录页; 接口调用返回 401,不做跳转 —— 让 curl / SDK 拿到明确的状态码。