Skip to content

Commit d1f76c1

Browse files
authored
Merge pull request #314 from justinsb/mock_watch_flush
mockkubeapiserver: send header of watch eagerly
2 parents 76d36bc + 974117e commit d1f76c1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mockkubeapiserver/listresource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func (req *listResource) doWatch(ctx context.Context, s *MockKubeAPIServer, reso
103103
var opt WatchOptions
104104
opt.Namespace = req.Namespace
105105

106+
w.WriteHeader(200)
107+
if f, ok := w.(http.Flusher); ok {
108+
f.Flush()
109+
}
110+
106111
return s.storage.Watch(ctx, resource, opt, func(ev *watchEvent) error {
107112
klog.V(2).Infof("sending watch event %s", string(ev.JSON()))
108113
if partialObjectMetadata {

0 commit comments

Comments
 (0)