Remove code duplication across branches
This commit is contained in:
committed by
Quentin Gliech
parent
6b37ae4011
commit
6defdb2d15
@@ -68,21 +68,16 @@ mod builtin {
|
||||
let len = asset.data.len().try_into().unwrap();
|
||||
let mime = mime_guess::from_path(path).first_or_octet_stream();
|
||||
|
||||
let headers = (
|
||||
TypedHeader(ContentType::from(mime)),
|
||||
TypedHeader(ContentLength(len)),
|
||||
TypedHeader(etag),
|
||||
);
|
||||
|
||||
let res = if is_head {
|
||||
(
|
||||
TypedHeader(ContentType::from(mime)),
|
||||
TypedHeader(ContentLength(len)),
|
||||
TypedHeader(etag),
|
||||
)
|
||||
.into_response()
|
||||
headers.into_response()
|
||||
} else {
|
||||
(
|
||||
TypedHeader(ContentType::from(mime)),
|
||||
TypedHeader(ContentLength(len)),
|
||||
TypedHeader(etag),
|
||||
asset.data,
|
||||
)
|
||||
.into_response()
|
||||
(headers, asset.data).into_response()
|
||||
};
|
||||
|
||||
Some(res)
|
||||
|
||||
Reference in New Issue
Block a user