Skip to content

Commit

Permalink
add interface check in handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gregns1 committed Jan 3, 2025
1 parent b989e99 commit 2e354d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rest/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ func (h *handler) validateAndWriteHeaders(method handlerMethod, accessPermission
}
}
h.updateResponseWriter()
// ensure wrapped ResponseWriter implements http.Flusher
_, ok := h.response.(http.Flusher)
if !ok {
return fmt.Errorf("ResponseWriter does not implement Flusher interface")
}
return nil
}

Expand Down

0 comments on commit 2e354d1

Please sign in to comment.