| Crates.io | actix-web-reqid |
| lib.rs | actix-web-reqid |
| version | 0.1.2 |
| created_at | 2025-07-11 22:22:27.785994+00 |
| updated_at | 2025-07-11 22:50:44.484469+00 |
| description | Middleware for Actix Web to generate and extract UUID request IDs. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1748567 |
| size | 45,785 |
Tool to work with Request ID(UUID).
This crate is based on timtonk/actix-web-middleware-requestid.
Add the middleware to your Actix Web application to automatically generate and attach a UUID request ID to each incoming request.
use actix_web::{App, HttpServer};
use actix_web_reqid::RequestIDWrapper;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(RequestIDWrapper)
// your routes here
})
.bind("127.0.0.1:8080")?
.run()
.await
}
use actix_web::{get, HttpResponse, Responder};
use actix_web_reqid::RequestID;
#[get("/")]
async fn index(request_id: RequestID) -> impl Responder {
HttpResponse::Ok().body(format!("Request ID: {}", request_id.0))
}
If the request ID is missing, the extractor will return a 400 Bad Request error.
This middleware helps you trace requests by assigning a unique UUID to each request and making it accessible in your handlers.