File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ func (r *responseWriterDelegator) WriteHeader(code int) {
62
62
}
63
63
64
64
func (r * responseWriterDelegator ) Write (b []byte ) (int , error ) {
65
+ // If applicable, call WriteHeader here so that observeWriteHeader is
66
+ // handled appropriately.
65
67
if ! r .wroteHeader {
66
68
r .WriteHeader (http .StatusOK )
67
69
}
@@ -82,12 +84,19 @@ func (d closeNotifierDelegator) CloseNotify() <-chan bool {
82
84
return d .ResponseWriter .(http.CloseNotifier ).CloseNotify ()
83
85
}
84
86
func (d flusherDelegator ) Flush () {
87
+ // If applicable, call WriteHeader here so that observeWriteHeader is
88
+ // handled appropriately.
89
+ if ! d .wroteHeader {
90
+ d .WriteHeader (http .StatusOK )
91
+ }
85
92
d .ResponseWriter .(http.Flusher ).Flush ()
86
93
}
87
94
func (d hijackerDelegator ) Hijack () (net.Conn , * bufio.ReadWriter , error ) {
88
95
return d .ResponseWriter .(http.Hijacker ).Hijack ()
89
96
}
90
97
func (d readerFromDelegator ) ReadFrom (re io.Reader ) (int64 , error ) {
98
+ // If applicable, call WriteHeader here so that observeWriteHeader is
99
+ // handled appropriately.
91
100
if ! d .wroteHeader {
92
101
d .WriteHeader (http .StatusOK )
93
102
}
You can’t perform that action at this time.
0 commit comments