actix-middleware-etag

Crates.ioactix-middleware-etag
lib.rsactix-middleware-etag
version0.4.6
created_at2022-09-29 08:20:33.103137+00
updated_at2025-08-04 10:00:05.839781+00
descriptionETag middleware for Actix web >= 4.8
homepagehttps://github.com/chriswk/actix-middleware-etag
repositoryhttps://github.com/chriswk/actix-middleware-etag
max_upload_size
id676445
size87,765
Christopher Kolstad (chriswk)

documentation

README

ETag middleware for Actix web

To use

use actix_web::{web, App, HttpServer, HttpResponse, Error};
use actix_middleware_etag::{Etag};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(move ||
            App::new()
            // Add etag headers to your actix application. Calculating the hash of your GET bodies and putting the base64 hash in the ETag header
            .wrap(Etag::default())
                ...
        .bind(("127.0.0.1", 8080))?
        .run()
        .await
}

This will hash all bodies for GET requests and base64 encode the hash as a weak ETag header in the response

Commit count: 34

cargo fmt