Skip to content

Commit a30689c

Browse files
committed
fix: add ConfigureAwait(false) to prevent sync context deadlocks
1 parent db03be5 commit a30689c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

CloudConvert.API/WebApiHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
1212
{
1313
try
1414
{
15-
var response = await base.SendAsync(request, cancellationToken);
15+
var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
1616

1717
if ((int)response.StatusCode >= 400)
1818
{
19-
throw new WebApiException((await response.Content.ReadAsStringAsync(cancellationToken)).TrimLengthWithEllipsis(20000));
19+
var errorBody = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
20+
throw new WebApiException(errorBody.TrimLengthWithEllipsis(20000));
2021
}
2122

2223
return response;

0 commit comments

Comments
 (0)