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

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

Merged
merged 2 commits into from Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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