diff --git a/.appveyor.yml b/.appveyor.yml index eb25a73..648f701 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,5 @@ version: '{build}' +skip_branch_with_pr: true image: Visual Studio 2017 install: - cmd: cd src @@ -6,4 +7,7 @@ build_script: - cmd: dotnet build Castle.Sdk -c Release -f netstandard2.0 - cmd: dotnet build Castle.Sdk -c Release -f net461 test_script: - - cmd: dotnet test Tests \ No newline at end of file + - ps: nuget install OpenCover -OutputDirectory packages -Version 4.7.922 + - ps: dotnet tool install coveralls.net --tool-path tools + - ps: .\packages\OpenCover.4.7.922\tools\OpenCover.Console.exe -register:user -target:dotnet.exe -targetargs:"test Tests\Tests.csproj" -filter:"+[Castle.Sdk*]*" -oldStyle -output:opencoverCoverage.xml + - ps: .\tools\csmacnz.coveralls.exe --opencover -i opencoverCoverage.xml --repoToken $env:COVERALLS_REPO_TOKEN --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage $env:APPVEYOR_REPO_COMMIT_MESSAGE --jobId $env:APPVEYOR_JOB_ID diff --git a/src/Castle.Sdk/Infrastructure/HttpMessageSender.cs b/src/Castle.Sdk/Infrastructure/HttpMessageSender.cs index 5676955..acbfc8a 100644 --- a/src/Castle.Sdk/Infrastructure/HttpMessageSender.cs +++ b/src/Castle.Sdk/Infrastructure/HttpMessageSender.cs @@ -32,7 +32,7 @@ public HttpMessageSender(CastleConfiguration configuration, IInternalLogger logg public async Task Post(string endpoint, object payload) where TResponse : class, new() { - var jsonContent = PayloadToJson(payload); + var jsonContent = payload.ToHttpContent(); var message = new HttpRequestMessage(HttpMethod.Post, endpoint) { Content = jsonContent @@ -58,7 +58,7 @@ public async Task Put(string endpoint) public async Task Delete(string endpoint, object payload) where TResponse : class, new() { - var jsonContent = PayloadToJson(payload); + var jsonContent = payload.ToHttpContent(); var message = new HttpRequestMessage(HttpMethod.Delete, endpoint) { Content = jsonContent @@ -91,14 +91,6 @@ private async Task SendRequest(HttpRequestMessage requestM requestMessage.RequestUri.AbsoluteUri, (int)_httpClient.Timeout.TotalMilliseconds); } - } - - private static StringContent PayloadToJson(object payload) - { - return new StringContent( - JsonForCastle.SerializeObject(payload), - Encoding.UTF8, - "application/json"); - } + } } } diff --git a/src/Tests/When_creating_configuration.cs b/src/Tests/When_creating_configuration.cs index 3175d47..b7c76b2 100644 --- a/src/Tests/When_creating_configuration.cs +++ b/src/Tests/When_creating_configuration.cs @@ -14,5 +14,13 @@ public void Should_always_add_Cookie_when_setting_blacklist(CastleConfiguration configuration.Blacklist.Should().Contain("Cookie"); } + + [Fact] + public void Should_be_able_to_get_recommended_whitelist() + { + var result = Castle.Headers.Whitelist; + + result.Should().NotBeEmpty(); + } } }