From ec5c4759190006261014c08aceccb6f99aa53d50 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 9 Mar 2011 10:24:50 -0800 Subject: [PATCH] http: add Flusher type; remove Flush from ResponseWriter The Flush functionality wasn't removed, but now you have to test if your ResponseWriter is also a Flusher: func ServeHTTP(rw http.ResponseWriter, req *http.Request) { if f, ok := rw.(http.Flusher); ok { f.Flush() } } R=rsc, bradfitzwork CC=gburd, golang-dev https://golang.org/cl/4239077 --- src/pkg/http/server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go index 8a8cdd9332..5f36af5484 100644 --- a/src/pkg/http/server.go +++ b/src/pkg/http/server.go @@ -70,7 +70,16 @@ type ResponseWriter interface { // Thus explicit calls to WriteHeader are mainly used to // send error codes. WriteHeader(int) +} +// The Flusher interface is implemented by ResponseWriters that allow +// an HTTP handler to flush buffered data to the client. +// +// Note that even for ResponseWriters that support Flush, +// if the client is connected through an HTTP proxy, +// the buffered data may not reach the client until the response +// completes. +type Flusher interface { // Flush sends any buffered data to the client. Flush() } -- 2.50.0