diff options
Diffstat (limited to 'git/service/write_flusher.go')
-rw-r--r-- | git/service/write_flusher.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/git/service/write_flusher.go b/git/service/write_flusher.go new file mode 100644 index 0000000..f25a5ae --- /dev/null +++ b/git/service/write_flusher.go @@ -0,0 +1,25 @@ +package service + +import ( + "io" + "net/http" +) + +func newWriteFlusher(w http.ResponseWriter) io.Writer { + return writeFlusher{w.(interface { + io.Writer + http.Flusher + })} +} + +type writeFlusher struct { + wf interface { + io.Writer + http.Flusher + } +} + +func (w writeFlusher) Write(p []byte) (int, error) { + defer w.wf.Flush() + return w.wf.Write(p) +} |