From 9454bb7e18162ef4c7e56584dd86b1d1ecb05bee Mon Sep 17 00:00:00 2001 From: Felipe Cardozo Date: Tue, 21 Nov 2023 23:14:40 -0300 Subject: [PATCH] use redirect instead stream --- cmd/server/main.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index e8153d8..d91fd26 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,7 +1,6 @@ package main import ( - "net" "net/http" "os" "time" @@ -17,17 +16,6 @@ func main() { goCache := cache.New(5*time.Minute, 10*time.Minute) bucketName := os.Getenv("BUCKET_NAME") - timeout := time.Duration(5) * time.Second - transport := &http.Transport{ - ResponseHeaderTimeout: timeout, - Dial: func(network, addr string) (net.Conn, error) { - return net.DialTimeout(network, addr, timeout) - }, - DisableKeepAlives: true, - } - client := &http.Client{ - Transport: transport, - } e := echo.New() // Middleware @@ -47,7 +35,7 @@ func main() { return err } - return streamFile(c, client, snapshot.Filename, snapshot.URL) + return c.Redirect(http.StatusFound, snapshot.URL) } } api := func(c echo.Context) error {