Commit f83b48e
fix: replace MaxBytesReader(nil) with io.LimitReader to avoid nil ResponseWriter panic
http.MaxBytesReader panics when the ResponseWriter is nil and the body
exceeds the limit. Switched to io.LimitReader (reads maxBytes+1 to detect
overflow) and io.ReadAll, eliminating the nil-writer dependency entirely.
Replaced the string-comparison EOF check with errors.Is(err, io.EOF).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent c92c9cb commit f83b48e
1 file changed
Lines changed: 11 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| 311 | + | |
| 312 | + | |
309 | 313 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
330 | 321 | | |
331 | 322 | | |
332 | 323 | | |
| |||
0 commit comments