From 916df915b328bdfad43eee953c121e1f31f08e0d Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 9 Apr 2021 14:19:38 +0530 Subject: [PATCH] Async copy. To improve performance, this results in better consistent average latency but lower throughput in some cases. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index e47f24d..1b02b6b 100644 --- a/main.go +++ b/main.go @@ -101,7 +101,7 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { w.WriteHeader(resp.StatusCode) - io.Copy(w, resp.Body) + go io.Copy(w, resp.Body) } func copyHeaders(from http.Header, to http.Header) {