mirror of
https://github.com/golang/go
synced 2024-11-22 06:44:40 -07:00
net/http: document that Error is to be used with plain text
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12276043
This commit is contained in:
parent
9742003ffc
commit
334761a666
@ -1196,6 +1196,7 @@ func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) {
|
||||
// Helper handlers
|
||||
|
||||
// Error replies to the request with the specified error message and HTTP code.
|
||||
// The error message should be plain text.
|
||||
func Error(w ResponseWriter, error string, code int) {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.WriteHeader(code)
|
||||
|
Loading…
Reference in New Issue
Block a user