Crates.io | miku-server-timing |
lib.rs | miku-server-timing |
version | 0.2.1 |
created_at | 2024-12-13 19:24:23.511625+00 |
updated_at | 2025-04-08 18:14:12.403651+00 |
description | An axum layer to inject the Server-Timing HTTP header into the response. |
homepage | |
repository | https://github.com/cxw620/miku-server-timing |
max_upload_size | |
id | 1482448 |
size | 46,265 |
An axum layer to inject the Server-Timing
HTTP header into the response.
For a reference on the header please see developer.mozilla.org.
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>
This crate is a fork of the above crate, modified to gain better performance, and can serve as a simple replacement.