From 5e853f2807f73af98e05a81f565815701037e03c Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Thu, 19 Jul 2018 10:37:32 +0800 Subject: [PATCH] fix the response not send issue when set header first --- stream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream.go b/stream.go index 0f786ee..3d5cd70 100644 --- a/stream.go +++ b/stream.go @@ -101,7 +101,7 @@ func (s *stream) Write(buf []byte) (int, error) { if s.closed { return 0, io.EOF } - if s.conn.isServer && s.response == nil { + if s.conn.isServer && (s.response == nil || s.response.StatusCode == 0) { s.WriteHeader(http.StatusOK) }