Fix use of ResponseWriter.WriteInfo and ResponseWriter.WriteError
This commit is contained in:
parent
94b6b874e4
commit
a4095fac05
|
@ -938,6 +938,10 @@ func (w *response) Write(b []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *response) WriteError(err string) error {
|
func (w *response) WriteError(err string) error {
|
||||||
|
if w.rt == 0 {
|
||||||
|
w.rt = 2
|
||||||
|
}
|
||||||
|
|
||||||
if w.rt != 2 {
|
if w.rt != 2 {
|
||||||
_, e := w.w.Write([]byte(err))
|
_, e := w.w.Write([]byte(err))
|
||||||
return e
|
return e
|
||||||
|
@ -954,6 +958,10 @@ func (w *response) WriteError(err string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *response) WriteInfo(msg string) error {
|
func (w *response) WriteInfo(msg string) error {
|
||||||
|
if w.rt == 0 {
|
||||||
|
w.rt = 2
|
||||||
|
}
|
||||||
|
|
||||||
if w.rt != 2 {
|
if w.rt != 2 {
|
||||||
_, e := w.w.Write([]byte(msg))
|
_, e := w.w.Write([]byte(msg))
|
||||||
return e
|
return e
|
||||||
|
|
Loading…
Reference in New Issue