endpoint: fix content-type parsing

This commit is contained in:
Astro 2023-04-15 23:46:58 +02:00
parent a8551ac48a
commit 832bd50926

View file

@ -48,7 +48,8 @@ where
// validate content-type
let content_type = if let Some(content_type) = req.headers()
.get(CONTENT_TYPE)
.and_then(|value| value.to_str().ok()) {
.and_then(|value| value.to_str().ok())
.and_then(|value| value.split(';').next()) {
content_type
} else {
return Err((StatusCode::UNSUPPORTED_MEDIA_TYPE, "No content-type".to_string()));