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