Commit 5df80b3
fix(api): prevent panic on 204 No Content responses with Go 1.26
Go 1.26 enforces that response status codes like 204 No Content
must not have a body. The OTLP middleware's finalize() method was
calling Write() even with empty data, causing a panic. Additionally,
NoContent() was routing through writeJSON() which unnecessarily set
Content-Type header on bodyless responses.
Constraint: Go 1.26 strictly enforces RFC 7230 no-body status codes
Rejected: Recover from panic in finalize | masks the root cause
Confidence: high
Scope-risk: narrow
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 2844b0a commit 5df80b3
2 files changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
0 commit comments