diff --git a/josh-proxy/src/juniper_hyper.rs b/josh-proxy/src/juniper_hyper.rs index 0c7882c9d..e18c5e326 100644 --- a/josh-proxy/src/juniper_hyper.rs +++ b/josh-proxy/src/juniper_hyper.rs @@ -62,10 +62,13 @@ async fn parse_req( let content_type = req .headers() .get(header::CONTENT_TYPE) - .map(HeaderValue::to_str); + .map(|x| HeaderValue::to_str(x).ok()) + .flatten() + .map(|x| x.split(";").next()) + .flatten(); match content_type { - Some(Ok("application/json")) => parse_post_json_req(req.into_body()).await, - Some(Ok("application/graphql")) => parse_post_graphql_req(req.into_body()).await, + Some("application/json") => parse_post_json_req(req.into_body()).await, + Some("application/graphql") => parse_post_graphql_req(req.into_body()).await, _ => return Err(new_response(StatusCode::BAD_REQUEST)), } } diff --git a/tests/proxy/graphql_path.t b/tests/proxy/graphql_path.t index 9bcf0fe7b..8677dbd54 100644 --- a/tests/proxy/graphql_path.t +++ b/tests/proxy/graphql_path.t @@ -61,4 +61,16 @@ } } (no-eol) + $ cat ../query | curl -s -X POST -H "content-type: application/json; charset=utf-8" --data @- "http://localhost:8002/~/graphql/real_repo.git" + { + "data": { + "rev": { + "dir": { + "path": "", + "hash": "fcd9aba1ef0c6d812452bdcb04ac155f5d7f42d6" + } + } + } + } (no-eol) + $ cat ${TESTTMP}/josh-proxy.out