Skip to content

Commit

Permalink
fix cast syntax (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
RiaanLaubscher authored Jul 11, 2024
1 parent 8d1ec74 commit 20f72b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ func (w *bodyWriter) Write(b []byte) (int, error) {

// implements http.Flusher
func (w *bodyWriter) Flush() {
if w.ResponseWriter.(http.Flusher) != nil {
w.ResponseWriter.(http.Flusher).Flush()
if f, ok := w.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
}

// implements http.Hijacker
func (w *bodyWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if w.ResponseWriter.(http.Hijacker) != nil {
return w.ResponseWriter.(http.Hijacker).Hijack()
if hi, ok := w.ResponseWriter.(http.Hijacker); ok {
return hi.Hijack()
}

return nil, nil, errors.New("Hijack not supported")
Expand Down

0 comments on commit 20f72b9

Please sign in to comment.