Skip to content

Commit fa4fc5b

Browse files
authored
Fixes dispose error (#27)
1 parent 7c6c439 commit fa4fc5b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Float.FileDownloader.Tests/DownloadRequest.Tests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public async Task TestCustomHandler()
9191
DownloadRequest.DownloadMessageHandler = mock.Object;
9292
await DownloadRequest.Download(new HttpRequestMessage(HttpMethod.Get, TestUriString()), TempFilePath());
9393
mock.Protected().Verify("SendAsync", Times.AtLeastOnce(), ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>());
94+
DownloadRequest.DownloadMessageHandler = null;
9495
}
9596
}
9697
}

Float.FileDownloader/DownloadRequest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ public static async Task<HttpResponseMessage> Download(HttpRequestMessage reques
3939
}
4040

4141
var messageHandler = DownloadMessageHandler ?? new HttpClientHandler();
42-
var shouldDisposeHandler = DownloadMessageHandler == null;
4342

44-
using (var client = new HttpClient(messageHandler, shouldDisposeHandler))
43+
using (var client = new HttpClient(messageHandler))
4544
{
4645
if (cancellationTokenSource == null)
4746
{

0 commit comments

Comments
 (0)