3 unstable releases
new 0.2.0 | Jan 15, 2025 |
---|---|
0.1.2 | Dec 24, 2024 |
0.1.1 | Dec 13, 2024 |
0.1.0 |
|
#535 in HTTP server
212 downloads per month
18KB
205 lines
miku-server-timing
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(miku_server_timing::ServerTimingLayer::new("HelloService"));
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;dur=102.0
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(
miku_server_timing::ServerTimingLayer::new("HelloService")
.with_description("whatever")
);
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 22
server-timing: HelloService;desc="whatever";dur=102.0
date: Wed, 19 Apr 2023 15:25:40 GMT
<h1>Hello, World!</h1>
Special thanks
This crate is a fork of the above crate, modified to gain better performance, and can serve as a simple replacement.
Dependencies
~1MB
~17K SLoC