From d0ec24066b5fbb4e3accc9c45f72f7c638b35dba Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Sat, 5 Jun 2021 13:21:35 +0300 Subject: - Websockets bug fixing and polishing Signed-off-by: Valery Piashchynski --- plugins/http/plugin.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/http/plugin.go') diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index 1952679a..ba83344a 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -248,6 +248,12 @@ func (p *Plugin) Stop() error { // ServeHTTP handles connection using set of middleware and pool PSR-7 server. func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) { + defer func() { + err := r.Body.Close() + if err != nil { + p.log.Error("body close", "error", err) + } + }() if headerContainsUpgrade(r) { http.Error(w, "server does not support upgrade header", http.StatusInternalServerError) return -- cgit v1.2.3