fix: use ResponseHeadersRead for streaming-friendly HTTP responses

This commit is contained in:
qwsdcvghyu89
2026-04-03 12:01:46 +11:00
parent 2965270928
commit 0c0c11b278
+2 -1
View File
@@ -35,8 +35,9 @@ namespace Beam.Api;
foreach (var header in Headers)
request.Headers.Add(header.Key, header.Value);
logger?.LogInformation("Fetching '{}' with method '{}', content-type '{}', and headers '{}'", Uri, Method, ContentType, JsonSerializer.Serialize(request.Headers.ToDictionary()));
var response = await Client.SendAsync(request, ct);
var response = await Client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, ct);
if (tries is not null && tries?.@try < tries?.max && !SuccessCodes.Contains(response.StatusCode)) {
await Task.Delay((int)Math.Min(Math.Pow(2, tries.Value.@try), 60) * 1000, ct);