From 278102945aec979c713c8464feacfb89188d155c Mon Sep 17 00:00:00 2001 From: Riaan Laubscher Date: Thu, 11 Jul 2024 15:17:31 +0200 Subject: [PATCH] fix cast syntax --- dump.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dump.go b/dump.go index 79da02c..e33fc67 100644 --- a/dump.go +++ b/dump.go @@ -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")