fix: use ResponseHeadersRead for streaming-friendly HTTP responses
This commit is contained in:
+2
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user