From 1b02624cc6d062d69dfea280380ca68e0d512797 Mon Sep 17 00:00:00 2001 From: "st. chibie" Date: Sat, 14 Dec 2019 22:43:04 +0100 Subject: [PATCH] fix headers NoneType case in GraphQLTestCase.query --- graphene_django/utils/testing.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/graphene_django/utils/testing.py b/graphene_django/utils/testing.py index 89b293c..5a02025 100644 --- a/graphene_django/utils/testing.py +++ b/graphene_django/utils/testing.py @@ -53,10 +53,14 @@ class GraphQLTestCase(TestCase): body["variables"]["input"] = input_data else: body["variables"] = {"input": input_data} - - resp = self._client.post( - self.GRAPHQL_URL, json.dumps(body), content_type="application/json", **headers - ) + if headers: + resp = self._client.post( + self.GRAPHQL_URL, json.dumps(body), content_type="application/json", **headers + ) + else: + resp = self._client.post( + self.GRAPHQL_URL, json.dumps(body), content_type="application/json" + ) return resp def assertResponseNoErrors(self, resp):