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

Commit

Permalink
Merge pull request #1026 from cocoa-mhlw/feature/accept-encoding
Browse files Browse the repository at this point in the history
Added accept-encoding
  • Loading branch information
cocoa-dev004 authored Jun 2, 2022
2 parents dd9b150 + 643a0a6 commit c6bd611
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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

0 comments on commit c6bd611

Please sign in to comment.