Commit c71b865
utils.query: surface unhandled 4xx/5xx and stop mutating the caller's payload
Two related correctness fixes to the shared HTTP wrapper used by every
module in the package.
* The function only formatted explicit messages for 400, 404, 414, and
500/502/503. Any other status (401, 403, 405, 408, 429, 501, 504, …)
fell through and the response was returned as if it had succeeded —
callers parsed an HTML error page as RDB or CSV. Add a
``raise_for_status()`` after the explicit branches so every
non-success surfaces, while keeping the friendlier messages for the
codes we already format.
* The body did
``for key, value in payload.items(): payload[key] = to_str(...)``,
mutating the caller's dict. List values came back replaced with their
stringified joins, breaking any caller that re-used the dict. Build a
fresh ``params`` dict in a comprehension and leave the input alone.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 51ac674 commit c71b865
2 files changed
Lines changed: 38 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
178 | 179 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 180 | | |
187 | 181 | | |
188 | | - | |
| 182 | + | |
189 | 183 | | |
190 | 184 | | |
191 | 185 | | |
| |||
218 | 212 | | |
219 | 213 | | |
220 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
221 | 219 | | |
222 | 220 | | |
223 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
44 | 75 | | |
45 | 76 | | |
46 | 77 | | |
| |||
0 commit comments