1
0
mirror of https://github.com/pcvolkmer/mv64e-rest-to-kafka-gateway synced 2025-09-13 09:12:51 +00:00

feat: accept custom media type application/vnd.dnpm.v2.mtb+json

This commit is contained in:
2025-07-12 10:29:31 +02:00
parent 523ad89783
commit ea72454a79
3 changed files with 69 additions and 8 deletions

View File

@@ -68,9 +68,7 @@ async fn main() -> Result<(), ()> {
&CONFIG.bootstrap_server,
)?);
let routes = routes(sender)
.layer(from_fn(check_content_type_header))
.layer(from_fn(check_basic_auth));
let routes = routes(sender).layer(from_fn(check_basic_auth));
#[cfg(debug_assertions)]
let routes = routes.layer(TraceLayer::new_for_http());
@@ -94,7 +92,11 @@ async fn check_content_type_header(request: Request<Body>, next: Next) -> Respon
.get(CONTENT_TYPE)
.map(HeaderValue::as_bytes)
{
Some(b"application/json" | b"application/json; charset=utf-8") => next.run(request).await,
Some(
b"application/json"
| b"application/json; charset=utf-8"
| b"application/vnd.dnpm.v2.mtb+json",
) => next.run(request).await,
_ => UnsupportedContentType.into_response(),
}
}