Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Added accept-encoding #1026

Merged
2 commits merged into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ public DiagnosisKeyRepository(
ILoggerService loggerService
)
{
_httpClient = httpClientService.Create();
_httpClient = httpClientService.Create(new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
_loggerService = loggerService;
}

Expand Down
5 changes: 5 additions & 0 deletions Covid19Radar/Covid19Radar/Services/HttpClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Covid19Radar.Services
public interface IHttpClientService
{
HttpClient Create();
HttpClient Create(HttpClientHandler handler);
}
public class HttpClientService : IHttpClientService
{
Expand All @@ -20,5 +21,9 @@ public HttpClient Create()
{
return new HttpClient();
}
public HttpClient Create(HttpClientHandler handler)
{
return new HttpClient(handler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async void GetDiagnosisKeysListAsyncTests_Success()
"application/json"
)
);
mockClientService.Setup(x => x.Create()).Returns(client);
mockClientService.Setup(x => x.Create(It.IsAny<HttpClientHandler>())).Returns(client);

var unitUnderTest = CreateRepository();
var (_, result) = await unitUnderTest.GetDiagnosisKeysListAsync("https://example.com", default);
Expand All @@ -71,7 +71,7 @@ public async void GetDiagnosisKeysListAsyncTests_HttpError(System.Net.HttpStatus
statusCode,
new StringContent("", Encoding.UTF8, "application/json")
);
mockClientService.Setup(x => x.Create()).Returns(client);
mockClientService.Setup(x => x.Create(It.IsAny<HttpClientHandler>())).Returns(client);

var unitUnderTest = CreateRepository();
var (_, result) = await unitUnderTest.GetDiagnosisKeysListAsync("https://example.com", default);
Expand All @@ -89,7 +89,7 @@ public async void DownloadDiagnosisKeysAsyncTests_Success()
HttpStatusCode.OK,
content
);
mockClientService.Setup(x => x.Create()).Returns(client);
mockClientService.Setup(x => x.Create(It.IsAny<HttpClientHandler>())).Returns(client);

var entry = new DiagnosisKeyEntry()
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public async void DownloadDiagnosisKeysAsyncTests_HttpError(System.Net.HttpStatu
statusCode,
content
);
mockClientService.Setup(x => x.Create()).Returns(client);
mockClientService.Setup(x => x.Create(It.IsAny<HttpClientHandler>())).Returns(client);

var entry = new DiagnosisKeyEntry()
{
Expand Down