From 51068a747f1a32dbce24c499561a0f5ecb7f7158 Mon Sep 17 00:00:00 2001 From: wangxiaolei Date: Tue, 21 Feb 2023 00:21:57 +0800 Subject: [PATCH] chore: recoverer middleware skip write header on upgrade connection (#795) --- middleware/recoverer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/middleware/recoverer.go b/middleware/recoverer.go index 8fa69bad..612e155a 100644 --- a/middleware/recoverer.go +++ b/middleware/recoverer.go @@ -36,7 +36,9 @@ func Recoverer(next http.Handler) http.Handler { PrintPrettyStack(rvr) } - w.WriteHeader(http.StatusInternalServerError) + if r.Header.Get("Connection") != "Upgrade" { + w.WriteHeader(http.StatusInternalServerError) + } } }()