Commit 334761a6 authored by Andrew Balholm's avatar Andrew Balholm Committed by Brad Fitzpatrick

net/http: document that Error is to be used with plain text

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12276043
parent 9742003f
...@@ -1196,6 +1196,7 @@ func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) { ...@@ -1196,6 +1196,7 @@ func (f HandlerFunc) ServeHTTP(w ResponseWriter, r *Request) {
// Helper handlers // Helper handlers
// Error replies to the request with the specified error message and HTTP code. // 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) { func Error(w ResponseWriter, error string, code int) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(code) w.WriteHeader(code)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment