Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix #10837 by adding JSON encoding/decoding to the Module API example… (
Browse files Browse the repository at this point in the history
  • Loading branch information
cvwright authored Sep 17, 2021
1 parent b4c1af8 commit 6b6bb81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/10845.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix some crashes in the Module API example code, by adding JSON encoding/decoding.
4 changes: 2 additions & 2 deletions docs/modules/spam_checker_callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6b6bb81

Please sign in to comment.