From dae5b130bb4b3a265de07b6895bfe469ae1199a6 Mon Sep 17 00:00:00 2001 From: what Date: Thu, 24 Oct 2024 15:34:47 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E4=BC=98=E5=8C=96=20support/response,?= =?UTF-8?q?=20=E5=B9=B6=E6=96=B0=E5=A2=9E=20NewHttpStatusResponse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- support/response.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/support/response.go b/support/response.go index acbc7e5..8bd593d 100644 --- a/support/response.go +++ b/support/response.go @@ -35,12 +35,17 @@ var wsUpgrader = websocket.Upgrader{ } func (this HttpStatusResponse) Get(path ...string) req.GlobalParams { + if this.body == nil { + return req.NewGlobalParam("", nil) + } return this.body.Get(path...) } func (this HttpStatusResponse) Send(w http.ResponseWriter, r *http.Request) { w.WriteHeader(this.status) - this.body.Send(w, r) + if this.body != nil { + this.body.Send(w, r) + } } func (this RawResponse) Get(path ...string) req.GlobalParams {