Skip to content
Snippets Groups Projects
Unverified Commit 6b6bb81b authored by Charles Wright's avatar Charles Wright Committed by GitHub
Browse files

Fix #10837 by adding JSON encoding/decoding to the Module API example… (#10845)

parent b4c1af8c
No related branches found
No related tags found
No related merge requests found
Fix some crashes in the Module API example code, by adding JSON encoding/decoding.
......@@ -136,9 +136,9 @@ class IsUserEvilResource(Resource):
self.evil_users = config.get("evil_users") or []
def render_GET(self, request: Request):
user = request.args.get(b"user")[0]
user = request.args.get(b"user")[0].decode()
request.setHeader(b"Content-Type", b"application/json")
return json.dumps({"evil": user in self.evil_users})
return json.dumps({"evil": user in self.evil_users}).encode()
class ListSpamChecker:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment