This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use etag::EntityTag; | |
// Based on alextes's implementation (https://gist.github.com/alextes/4095b1fca7d58bd3100825e10e882e57) | |
// which already provided support for If-None-Match/ETag | |
// but with support for precomputed ETags and If-Modified-Since/Last-Modified | |
async fn conditional_mw<B>(request: Request<B>, next: Next<B>) -> Result<Response, StatusCode> { | |
let if_none_match_header = request.headers().get(header::IF_NONE_MATCH).cloned(); | |
let if_modified_since_header = request.headers().get(header::IF_MODIFIED_SINCE).cloned(); | |
// let path = request.uri().path().to_owned(); | |
let response = next.run(request).await; |