mirror of
https://github.com/golang/go
synced 2024-11-18 00:04:43 -07:00
net/http: declare publicErr as a constant
Do the same as the code above: "case err == errTooLarge", declare publicErr as a constant to avoid runtime calls.
This commit is contained in:
parent
98617fd23f
commit
71d4458ded
@ -1971,7 +1971,7 @@ func (c *conn) serve(ctx context.Context) {
|
||||
fmt.Fprintf(c.rwc, "HTTP/1.1 %d %s: %s%s%d %s: %s", v.code, StatusText(v.code), v.text, errorHeaders, v.code, StatusText(v.code), v.text)
|
||||
return
|
||||
}
|
||||
publicErr := "400 Bad Request"
|
||||
const publicErr = "400 Bad Request"
|
||||
fmt.Fprintf(c.rwc, "HTTP/1.1 "+publicErr+errorHeaders+publicErr)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user