Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

server/internal/registry: implement CloseNotify and Flush (for now) (#9402)

Blake Mizerany41dc280491a7
diff --git a/server/internal/registry/server.go b/server/internal/registry/server.go
index 8d6dc1aa0..8eb6daf89 100644
--- a/server/internal/registry/server.go
+++ b/server/internal/registry/server.go
@@ -72,6 +72,26 @@ func (r *statusCodeRecorder) WriteHeader(status int) {
r.ResponseWriter.WriteHeader(status)
}
+var (
+ _ http.ResponseWriter = (*statusCodeRecorder)(nil)
+ _ http.CloseNotifier = (*statusCodeRecorder)(nil)
+ _ http.Flusher = (*statusCodeRecorder)(nil)
+)
+
+// CloseNotify implements the http.CloseNotifier interface, for Gin. Remove with Gin.
+//
+// It panics if the underlying ResponseWriter is not a CloseNotifier.
+func (r *statusCodeRecorder) CloseNotify() <-chan bool {
+ return r.ResponseWriter.(http.CloseNotifier).CloseNotify()
+}
+
+// Flush implements the http.Flusher interface, for Gin. Remove with Gin.
+//
+// It panics if the underlying ResponseWriter is not a Flusher.
+func (r *statusCodeRecorder) Flush() {
+ r.ResponseWriter.(http.Flusher).Flush()
+}
+
func (r *statusCodeRecorder) status() int {
return cmp.Or(r._status, 200)
}