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:
parent
21ab55ff05
commit
ec2a49b5bb
1 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,7 @@ package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
b64 "encoding/base64"
|
b64 "encoding/base64"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -20,12 +21,14 @@ func Routes(route *gin.Engine) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
context.Error(err)
|
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")
|
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)
|
context.JSON(imageResp.StatusCode, imageResp.Body)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue