CreatedBy Header

This commit is contained in:
Paul Zinselmeyer 2023-10-20 15:11:44 +02:00
parent 0e4532828a
commit 5af5bb3e95

View file

@ -11,7 +11,7 @@ use axum::{
body::{HttpBody, StreamBody},
debug_handler,
extract::{BodyStream, FromRef, FromRequest, Multipart, Path, Query, State},
headers::ContentType,
headers::{ContentType, Range},
http::{
header::{self, CONTENT_TYPE},
HeaderMap, Request, StatusCode,
@ -355,6 +355,9 @@ async fn get_item(
header::CONTENT_LENGTH,
metadata.size.unwrap_or_default().into(),
);
if let Ok(subject) = metadata.subject.parse() {
headers.insert("CreatedBy", subject);
}
if let Some(content_type) = metadata.content_type.and_then(|x| x.parse().ok()) {
headers.insert(header::CONTENT_TYPE, content_type);