Fix HTTPResponseRecorder playing back a zero status code
This commit is contained in:
parent
e292c9fbb2
commit
561e72427f
6
http.go
6
http.go
@ -45,11 +45,15 @@ func (this *HTTPResponseRecorder) WriteHeader (statusCode int) {
|
||||
// recorder.
|
||||
func (this *HTTPResponseRecorder) Play (res http.ResponseWriter) error {
|
||||
defer this.Reset()
|
||||
status := this.Status
|
||||
if status == 0 {
|
||||
status = http.StatusOK
|
||||
}
|
||||
header := res.Header()
|
||||
for name, value := range this.Head {
|
||||
header[name] = value
|
||||
}
|
||||
res.WriteHeader(this.Status)
|
||||
res.WriteHeader(status)
|
||||
_, err := io.Copy(res, &this.buffer)
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user