feat: add shared size limit constants

This commit is contained in:
2026-05-18 15:08:26 +02:00
parent 56c8618f5f
commit 943285b356
6 changed files with 23 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"mal/internal/domain"
"mal/pkg/net/limits"
"mal/pkg/net/useragent"
"mal/pkg/net/utls"
"net/http"
@@ -279,7 +280,7 @@ func (c *AllAnimeProvider) graphqlRequest(ctx context.Context, query string, var
}
defer func() { _ = resp.Body.Close() }()
respBody, err := io.ReadAll(io.LimitReader(resp.Body, 2*1024*1024))
respBody, err := io.ReadAll(io.LimitReader(resp.Body, limits.MiB2))
if err != nil {
return nil, fmt.Errorf("read graphql response: %w", err)
}
@@ -334,7 +335,7 @@ func (c *AllAnimeProvider) graphqlRequestWithHash(ctx context.Context, showID, e
}
defer func() { _ = resp.Body.Close() }()
respBody, err := io.ReadAll(io.LimitReader(resp.Body, 2*1024*1022))
respBody, err := io.ReadAll(io.LimitReader(resp.Body, limits.MiB2))
if err != nil {
return nil, fmt.Errorf("read response: %w", err)
}