#axum-server #http-header #web-server #response-headers #timing #server-timing #layer

axum-server-timing

An axum layer to inject the Server-Timing HTTP header into the response

6 releases (2 stable)

1.0.1 Aug 19, 2024
1.0.0 Jul 23, 2024
0.3.1 Mar 25, 2024
0.3.0 Dec 1, 2023
0.1.0 Apr 19, 2023

#574 in HTTP server

Download history 164/week @ 2024-07-30 197/week @ 2024-08-06 418/week @ 2024-08-13 443/week @ 2024-08-20 203/week @ 2024-08-27 168/week @ 2024-09-03 182/week @ 2024-09-10 130/week @ 2024-09-17 163/week @ 2024-09-24 178/week @ 2024-10-01 160/week @ 2024-10-08 242/week @ 2024-10-15 101/week @ 2024-10-22 110/week @ 2024-10-29 263/week @ 2024-11-05 135/week @ 2024-11-12

641 downloads per month

MIT/Apache

19KB
191 lines

axum-server-timing

Latest Version

An axum layer to inject the Server-Timing HTTP header into the response.

For a reference on the header please see developer.mozilla.org.

Examples

Using the layer to inject the Server-Timing Header.

    let app = Router::new()
        .route("/", get(handler))
        .layer(axum_server_timing::ServerTimingLayer::new("HelloService"));

Output

HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;dur=102
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Using the layer to inject the Server-Timing Header with description.

    let app = Router::new()
        .route("/", get(handler))
        .layer(
        axum_server_timing::ServerTimingLayer::new("HelloService")
            .with_description("whatever")
        );

Output

HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;desc="whatever";dur=102
date: Wed, 19 Apr 2023 15:25:40 GMT

<h1>Hello, World!</h1>

Dependencies

~5–11MB
~124K SLoC