0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 13:13:00 -05:00

Fix Content-Length errors

This commit is contained in:
dragongoose 2023-05-31 19:36:57 -04:00
parent 21ab55ff05
commit ec2a49b5bb
No known key found for this signature in database
GPG key ID: 50DB99B921579009

View file

@ -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)
})
}