net/http: add proper panic message

Change-Id: Ibfb330eaf24e004ddec60a5ca08cdc780235ad8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/688315
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
yazdan 2025-07-16 11:42:54 +03:30 committed by Gopher Robot
parent 46b5839231
commit 10c5cf68d4

View file

@ -1614,7 +1614,7 @@ func writeStatusLine(bw *bufio.Writer, is11 bool, code int, scratch []byte) {
// It's illegal to call this before the header has been flushed. // It's illegal to call this before the header has been flushed.
func (w *response) bodyAllowed() bool { func (w *response) bodyAllowed() bool {
if !w.wroteHeader { if !w.wroteHeader {
panic("") panic("net/http: bodyAllowed called before the header was written")
} }
return bodyAllowedForStatus(w.status) return bodyAllowedForStatus(w.status)
} }