aboutsummaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-24 17:16:03 +0100
committerLibravatar Rutger Broekhoff2024-01-24 17:16:03 +0100
commit0f2692e43cac41917d24a1da24a45ebb266b88ea (patch)
tree1ac750c7a47785abaa7976b41aaf1ad94de79c5a /rs
parent7c75eccd5e2bbf453aa043ca3627b4596b8b738a (diff)
downloadgitolfs3-0f2692e43cac41917d24a1da24a45ebb266b88ea.tar.gz
gitolfs3-0f2692e43cac41917d24a1da24a45ebb266b88ea.zip
It is unforunate that I have to do this
It would be nicer if it would be somehow possible to tell the axum JSON extractor that I valdiate the content type myself. Or maybe I should just stop using the axum JSON extractor altogether, as it really isn't too complex.
Diffstat (limited to 'rs')
-rw-r--r--rs/server/src/main.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/rs/server/src/main.rs b/rs/server/src/main.rs
index b8428cb..cbac138 100644
--- a/rs/server/src/main.rs
+++ b/rs/server/src/main.rs
@@ -344,10 +344,11 @@ where
344{ 344{
345 type Rejection = GitLfsJsonRejection; 345 type Rejection = GitLfsJsonRejection;
346 346
347 async fn from_request(req: Request, state: &S) -> Result<Self, Self::Rejection> { 347 async fn from_request(mut req: Request, state: &S) -> Result<Self, Self::Rejection> {
348 if !has_git_lfs_json_content_type(&req) { 348 if !has_git_lfs_json_content_type(&req) {
349 return Err(GitLfsJsonRejection::MissingGitLfsJsonContentType); 349 return Err(GitLfsJsonRejection::MissingGitLfsJsonContentType);
350 } 350 }
351 req.headers_mut().insert(header::CONTENT_TYPE, HeaderValue::from_static("application/json"));
351 Json::<T>::from_request(req, state) 352 Json::<T>::from_request(req, state)
352 .await 353 .await
353 .map(GitLfsJson) 354 .map(GitLfsJson)