Skip to content

Commit 2e354d1

Browse files
committed
add interface check in handler
1 parent b989e99 commit 2e354d1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rest/handler.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,11 @@ func (h *handler) validateAndWriteHeaders(method handlerMethod, accessPermission
671671
}
672672
}
673673
h.updateResponseWriter()
674+
// ensure wrapped ResponseWriter implements http.Flusher
675+
_, ok := h.response.(http.Flusher)
676+
if !ok {
677+
return fmt.Errorf("ResponseWriter does not implement Flusher interface")
678+
}
674679
return nil
675680
}
676681

0 commit comments

Comments
 (0)