Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unleash/actix-middleware-etag
ETag middleware for Actix-web >4
https://github.com/unleash/actix-middleware-etag
Last synced: 7 days ago
JSON representation
ETag middleware for Actix-web >4
- Host: GitHub
- URL: https://github.com/unleash/actix-middleware-etag
- Owner: Unleash
- License: mit
- Created: 2022-09-17T15:02:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-03T11:54:45.000Z (2 months ago)
- Last Synced: 2024-10-03T17:36:41.744Z (about 1 month ago)
- Language: Rust
- Size: 135 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ETag middleware for Actix web
To use
```rust
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