summaryrefslogtreecommitdiffhomepage
path: root/src/go/unit/response.go
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-07-12 15:50:43 +0300
committerMax Romanov <max.romanov@nginx.com>2018-07-12 15:50:43 +0300
commite6cd1c4257945063473d12a1eeed8d07dfe05467 (patch)
tree11b2dfa2322ccfe01a72041ecb0b2ab917d59865 /src/go/unit/response.go
parent96a4f9f032de2ee385ba84bb3c31b437e9814686 (diff)
downloadunit-e6cd1c4257945063473d12a1eeed8d07dfe05467.tar.gz
unit-e6cd1c4257945063473d12a1eeed8d07dfe05467.tar.bz2
Go: http.Flusher implemented by unit.response.
This closes #133 issue on GitHub.
Diffstat (limited to 'src/go/unit/response.go')
-rw-r--r--src/go/unit/response.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/go/unit/response.go b/src/go/unit/response.go
index 44694011..801a52e5 100644
--- a/src/go/unit/response.go
+++ b/src/go/unit/response.go
@@ -65,3 +65,11 @@ func (r *response) WriteHeader(code int) {
r.Write([]byte("\r\n"))
}
+
+func (r *response) Flush() {
+ if !r.headerSent {
+ r.WriteHeader(http.StatusOK)
+ }
+
+ C.nxt_go_response_flush(r.c_req)
+}