From 0a68eefdc2cc2403d816b6178f720ebf06374215 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 22 Sep 2023 20:56:48 -0600 Subject: [PATCH] Fix middleware writer: Func now only returns an error when err is not nil. Signed-off-by: Jacob Weinstock --- ipxe/http/middleware.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ipxe/http/middleware.go b/ipxe/http/middleware.go index 7792efd4..c43e1d43 100644 --- a/ipxe/http/middleware.go +++ b/ipxe/http/middleware.go @@ -49,8 +49,11 @@ func (w *responseWriter) Write(b []byte) (int, error) { w.statusCode = 200 } n, err := w.ResponseWriter.Write(b) + if err != nil { + return 0, fmt.Errorf("failed writing response: %w", err) + } - return n, fmt.Errorf("writing response: %w", err) + return n, nil } func (w *responseWriter) WriteHeader(code int) {