Preserve authentication cancellation at the response limit

This commit is contained in:
2026-11-05 15:58:32 +00:00
parent beb18cc9d6
commit ff57dbf8b3
3 changed files with 48 additions and 1 deletions

View File

@@ -59,6 +59,9 @@ func (c *OpenAICompatibleClient) ProbeOpenRouterKey(ctx context.Context, endpoin
return result, nil
}
contents, err := io.ReadAll(io.LimitReader(response.Body, maxAuthenticationResponseBytes+1))
if err != nil && ctx.Err() != nil {
return result, ctx.Err()
}
if len(contents) > maxAuthenticationResponseBytes {
result.Overflow = true
return result, nil