]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: add proper panic message
authoryazdan <m.hossein95th@gmail.com>
Wed, 16 Jul 2025 08:12:54 +0000 (11:42 +0330)
committerGopher Robot <gobot@golang.org>
Mon, 28 Jul 2025 18:02:55 +0000 (11:02 -0700)
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>

src/net/http/server.go

index 1ca5a227efb9a86984b35c832ba14396dfa02bc7..cf0bd0a91d762463f7b2a54a666ed1ba0020dc5a 100644 (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.
 func (w *response) bodyAllowed() bool {
        if !w.wroteHeader {
-               panic("")
+               panic("net/http: bodyAllowed called before the header was written")
        }
        return bodyAllowedForStatus(w.status)
 }