fix integration tests

This commit is contained in:
6543 2022-07-15 20:57:10 +02:00
parent 8390f77ecd
commit b8ec53c52d
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
2 changed files with 3 additions and 3 deletions

View file

@ -83,9 +83,6 @@ func (client *Client) ServeRawContent(uri string) (*fasthttp.Response, error) {
return nil, err
}
// fasthttp else will set "Content-Length: 0"
res.SetBodyStream(&strings.Reader{}, -1)
if err != nil {
return nil, err
}

View file

@ -181,6 +181,9 @@ func (o *Options) Upstream(ctx *fasthttp.RequestCtx, giteaClient *gitea.Client,
var cacheBodyWriter bytes.Buffer
if res != nil {
if res.Header.ContentLength() > fileCacheSizeLimit {
// fasthttp else will set "Content-Length: 0"
ctx.Response.SetBodyStream(&strings.Reader{}, -1)
err = res.BodyWriteTo(ctx.Response.BodyWriter())
} else {
// TODO: cache is half-empty if request is cancelled - does the ctx.Err() below do the trick?