Skip to content

Commit

Permalink
fix issues in garbage collected issues cirospaciari#136 and cirospaci…
Browse files Browse the repository at this point in the history
  • Loading branch information
RajaSunrise committed Aug 7, 2024
1 parent 63b1546 commit fe34019
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/graphiql.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def graphiql_from(Query, Mutation=None):
context_value = req.preserve()

# get all incoming data and parses as json
body = await res.get_json()
body = res.get_json()

query = body["query"]
variables = body.get("variables", None)
Expand Down
4 changes: 2 additions & 2 deletions docs/upload-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Similar to `res.get_data()`, `res.get_json()` will decode the json as dict.
async def upload_json(res, req):
print(f"Posted to {req.get_url()}")
# await all the data and parses as json, returns None if fail
info = await res.get_json()
info = res.get_json()

print(info)

Expand Down Expand Up @@ -79,7 +79,7 @@ async def upload_multiple(res, req):
content_type = req.get_header("content-type")
# we can check the Content-Type to accept multiple formats
if content_type == "application/json":
data = await res.get_json()
data = res.get_json()
elif content_type == "application/x-www-form-urlencoded":
data = await res.get_form_urlencoded()
else:
Expand Down
4 changes: 2 additions & 2 deletions src/socketify/socketify.py
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,8 @@ async def get_text(self, encoding="utf-8"):
except Exception:
return None # invalid encoding

async def get_json(self):
data = await self.get_data()
def get_json(self):
data = self.get_data()
try:
return self.app._json_serializer.loads(data.getvalue().decode("utf-8"))
except Exception:
Expand Down

0 comments on commit fe34019

Please sign in to comment.