From 2338481bb1d5ab3af95188d21db70512b03ccf38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20Vikstr=C3=B6m?= Date: Thu, 3 Jul 2014 17:57:38 +0200 Subject: [PATCH] server: Flush headers when using wait=true and stream=true Many http clients will missbehave unless they get an initial http- response, even when long-polling. It also saves the user/client from having to handle headers on the first action of the watch, but rather handle the response immediately. --- server/v2/get_handler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/v2/get_handler.go b/server/v2/get_handler.go index cb87216e454..ae6b7589a1a 100644 --- a/server/v2/get_handler.go +++ b/server/v2/get_handler.go @@ -68,6 +68,7 @@ func handleWatch(key string, recursive, stream bool, waitIndex string, w http.Re closeChan := cn.CloseNotify() writeHeaders(w, s) + w.(http.Flusher).Flush() if stream { // watcher hub will not help to remove stream watcher