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

Commit 6b6bb81

Browse files
authored
Fix #10837 by adding JSON encoding/decoding to the Module API example… (#10845)
1 parent b4c1af8 commit 6b6bb81

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog.d/10845.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix some crashes in the Module API example code, by adding JSON encoding/decoding.

docs/modules/spam_checker_callbacks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ class IsUserEvilResource(Resource):
136136
self.evil_users = config.get("evil_users") or []
137137

138138
def render_GET(self, request: Request):
139-
user = request.args.get(b"user")[0]
139+
user = request.args.get(b"user")[0].decode()
140140
request.setHeader(b"Content-Type", b"application/json")
141-
return json.dumps({"evil": user in self.evil_users})
141+
return json.dumps({"evil": user in self.evil_users}).encode()
142142

143143

144144
class ListSpamChecker:

0 commit comments

Comments
 (0)