mirror of https://github.com/golang/go.git
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)
|
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
|
return
|
||||||
}
|
}
|
||||||
publicErr := "400 Bad Request"
|
const publicErr = "400 Bad Request"
|
||||||
fmt.Fprintf(c.rwc, "HTTP/1.1 "+publicErr+errorHeaders+publicErr)
|
fmt.Fprintf(c.rwc, "HTTP/1.1 "+publicErr+errorHeaders+publicErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue