Skip to content

Commit

Permalink
Fix middleware writer:
Browse files Browse the repository at this point in the history
Func now only returns an error when
err is not nil.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Sep 23, 2023
1 parent e2bed8d commit 0a68eef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ipxe/http/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0a68eef

Please sign in to comment.