diff --git a/error.go b/error.go index a4ba9859..0133e80e 100644 --- a/error.go +++ b/error.go @@ -147,6 +147,9 @@ func (e *RespError) MarshalJSON() ([]byte, error) { } func (e RespError) Write(w http.ResponseWriter) { + if w == nil { + return + } statusCode := e.StatusCode if statusCode == 0 { statusCode = http.StatusInternalServerError