Commit 60789e3
fix: Response.json() honors declared charset
Routes the body through self.text instead of json.loads(self.content),
so a declared charset (e.g. iso-8859-1) is respected before JSON
parsing. ASCII / UTF-8 bodies are unchanged. Docstring now explicitly
documents the json.JSONDecodeError raise contract.
Wrapping JSONDecodeError in a domain exception is left to a future
response-API revision.
Closes deferred-work entries: "Response.json() raises raw and ignores
charset" (retro) and "Response.json() honor declared charset" (1-2).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bb567f0 commit 60789e3
2 files changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| |||
0 commit comments