-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probable bug in GraphQL JSON request handling #45
Comments
I got it! |
@kennethreitz Thank you! There seems to be a different error now though, this time when non-async tests/test_responder.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.env/lib/python3.7/site-packages/requests/sessions.py:559: in post
return self.request('POST', url, data=data, json=json, **kwargs)
.env/lib/python3.7/site-packages/starlette/testclient.py:312: in request
json=json,
.env/lib/python3.7/site-packages/requests/sessions.py:512: in request
resp = self.send(prep, **send_kwargs)
.env/lib/python3.7/site-packages/requests/sessions.py:622: in send
r = adapter.send(request, **kwargs)
.env/lib/python3.7/site-packages/starlette/testclient.py:159: in send
raise exc from None
.env/lib/python3.7/site-packages/starlette/testclient.py:156: in send
loop.run_until_complete(connection(receive, send))
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:568: in run_until_complete
return future.result()
responder/api.py:71: in asgi
resp = await self._dispatch_request(req)
responder/api.py:112: in _dispatch_request
await self.graphql_response(req, resp, schema=view)
responder/api.py:200: in graphql_response
query = await self._resolve_graphql_query(req)
responder/api.py:180: in _resolve_graphql_query
return await req.media("json")["query"]
responder/models.py:197: in media
return self.formats[format](self)
responder/formats.py:23: in format_json
return json.loads(r.content)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = <coroutine object Request.content at 0x104cc49c8>, encoding = None, cls = None, object_hook = None, parse_float = None, parse_int = None, parse_constant = None
object_pairs_hook = None, kw = {}
def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
if not isinstance(s, (bytes, bytearray)):
> raise TypeError(f'the JSON object must be str, bytes or bytearray, '
f'not {s.__class__.__name__}')
E TypeError: the JSON object must be str, bytes or bytearray, not coroutine
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py:341: TypeError
==================================================================== 1 failed, 43 passed in 0.44 seconds =====================================================================
sys:1: RuntimeWarning: coroutine 'Request.content' was never awaited Sorry I'm not fixing this myself – I tried yesterday but got too deep into |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There seems to be a bug in parsing of JSON GraphQL requests.
Test case (disregard the fact that it would also fail if parsed successfully):
Result on the latest
master
:I tried fixing it myself, but got tangled in the web of
async/await
-s and ended up breaking other stuff 😅I will try again later unless someone else wants to pick it up.
The text was updated successfully, but these errors were encountered: