diff --git a/routes/proxy/proxy.go b/routes/proxy/proxy.go index 2eff5c4..cc32dac 100644 --- a/routes/proxy/proxy.go +++ b/routes/proxy/proxy.go @@ -2,6 +2,7 @@ package proxy import ( b64 "encoding/base64" + "io" "net/http" "github.com/gin-gonic/gin" @@ -20,12 +21,14 @@ func Routes(route *gin.Engine) { if err != nil { context.Error(err) } + body, err := io.ReadAll(imageResp.Body) + if err != nil { + context.Error(err) + } - reader := imageResp.Body - contentLength := imageResp.ContentLength contentType := imageResp.Header.Get("Content-Type") - context.DataFromReader(200, contentLength, contentType, reader, map[string]string{}) + context.Data(200, contentType, body) context.JSON(imageResp.StatusCode, imageResp.Body) }) }