Skip to content

Commit e718487

Browse files
committed
fix
1 parent 19f34a7 commit e718487

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/web/headers/canonical_url.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@ use crate::web::escaped_uri::EscapedURI;
22
use anyhow::Result;
33
use askama::filters::HtmlSafe;
44
use axum::http::uri::Uri;
5-
use axum_extra::headers::{ETag, Header, HeaderName, HeaderValue};
5+
use axum_extra::headers::{Header, HeaderName, HeaderValue};
66
use serde::Serialize;
77
use std::{fmt, ops::Deref};
88

9-
/// compute our etag header value from some content
10-
///
11-
/// Has to match the implementation in our build-script.
12-
pub fn compute_etag<T: AsRef<[u8]>>(content: T) -> ETag {
13-
let digest = md5::compute(&content);
14-
format!("\"{:x}\"", digest).parse().unwrap()
15-
}
16-
179
/// simplified typed header for a `Link rel=canonical` header in the response.
1810
///
1911
/// When given only a path, it builds a full docs.rs URL.

src/web/headers/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
mod canonical_url;
22
mod surrogate_key;
33

4+
use axum_extra::headers::ETag;
45
pub use canonical_url::CanonicalUrl;
56
use http::HeaderName;
67
pub use surrogate_key::{SURROGATE_KEY, SurrogateKey, SurrogateKeys};
78

89
/// Fastly's Surrogate-Control header
910
/// https://www.fastly.com/documentation/reference/http/http-headers/Surrogate-Control/
1011
pub static SURROGATE_CONTROL: HeaderName = HeaderName::from_static("surrogate-control");
12+
13+
/// compute our etag header value from some content
14+
///
15+
/// Has to match the implementation in our build-script.
16+
pub fn compute_etag<T: AsRef<[u8]>>(content: T) -> ETag {
17+
let digest = md5::compute(&content);
18+
format!("\"{:x}\"", digest).parse().unwrap()
19+
}

0 commit comments

Comments
 (0)