Skip to content

Commit 8b359ae

Browse files
committed
Fixed errors
1 parent 2a2c4fc commit 8b359ae

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

graphql_flask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .blueprint import GraphQL
2-
from .graphqlview import GraphQLView
32
from .graphiqlview import GraphiQLView
3+
from .graphqlview import GraphQLView
44

55
__all__ = ['GraphQL', 'GraphQLView', 'GraphiQLView']

graphql_flask/blueprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Blueprint
2-
from .graphqlview import GraphQLView
32
from .graphiqlview import GraphiQLView
3+
from .graphqlview import GraphQLView
44

55

66
class GraphQL(object):

graphql_flask/graphqlview.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from werkzeug.exceptions import BadRequest, MethodNotAllowed
2+
33
from flask import Response, request
44
from flask.views import View
55
from graphql.core import Source, parse
@@ -8,12 +8,13 @@
88
from graphql.core.type.schema import GraphQLSchema
99
from graphql.core.utils.get_operation_ast import get_operation_ast
1010
import six
11+
from werkzeug.exceptions import BadRequest, MethodNotAllowed
1112

1213

1314
class HttpError(Exception):
1415
def __init__(self, response, message=None, *args, **kwargs):
1516
self.response = response
16-
self.message = message = message or response.description.decode()
17+
self.message = message = message or response.description
1718
super(HttpError, self).__init__(message, *args, **kwargs)
1819

1920

tests/test_graphqlview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def test_handles_errors_caused_by_a_lack_of_query(client):
361361

362362

363363
def test_handles_invalid_json_bodies(client):
364-
response = client.post(url_string(), '[]', content_type='application/json')
364+
response = client.post(url_string(), data='[]', content_type='application/json')
365365

366366
assert response.status_code == 400
367367
assert response_json(response) == {
@@ -370,7 +370,7 @@ def test_handles_invalid_json_bodies(client):
370370

371371

372372
def test_handles_incomplete_json_bodies(client):
373-
response = client.post(url_string(), '{"query":', content_type='application/json')
373+
response = client.post(url_string(), data='{"query":', content_type='application/json')
374374

375375
assert response.status_code == 400
376376
assert response_json(response) == {

0 commit comments

Comments
 (0)