Skip to content

Commit ed01c1b

Browse files
committed
add an env var to disable strict compliance
1 parent a449ac1 commit ed01c1b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

server/http/src/service.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::convert::TryFrom;
2+
use std::env;
23
use std::pin::Pin;
34
use std::task::Context;
45
use std::task::Poll;
@@ -326,12 +327,16 @@ where
326327
let headers = req.headers();
327328
let content_type = headers.get("content-type");
328329

329-
if method == Method::POST && (content_type.is_none()) {
330-
return self.handle_requests_without_content_type().boxed();
331-
}
330+
let less_strict_graphql_compliance = env::var("LESS_STRICT_GRAPHQL_COMPLIANCE").is_ok();
331+
332+
if !less_strict_graphql_compliance {
333+
if method == Method::POST && (content_type.is_none()) {
334+
return self.handle_requests_without_content_type().boxed();
335+
}
332336

333-
if method == Method::POST && !self.has_request_body(&req) {
334-
return self.handle_requests_without_body().boxed();
337+
if method == Method::POST && !self.has_request_body(&req) {
338+
return self.handle_requests_without_body().boxed();
339+
}
335340
}
336341

337342
let is_mutation = req

0 commit comments

Comments
 (0)