Fix use of ResponseWriter.WriteInfo and ResponseWriter.WriteError

This commit is contained in:
James Mills 2016-09-14 16:25:14 +10:00
parent 94b6b874e4
commit a4095fac05
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
1 changed files with 8 additions and 0 deletions

View File

@ -938,6 +938,10 @@ func (w *response) Write(b []byte) (int, error) {
}
func (w *response) WriteError(err string) error {
if w.rt == 0 {
w.rt = 2
}
if w.rt != 2 {
_, e := w.w.Write([]byte(err))
return e
@ -954,6 +958,10 @@ func (w *response) WriteError(err string) error {
}
func (w *response) WriteInfo(msg string) error {
if w.rt == 0 {
w.rt = 2
}
if w.rt != 2 {
_, e := w.w.Write([]byte(msg))
return e