Skip to content

Commit

Permalink
Merge 82eba21 into 128b574
Browse files Browse the repository at this point in the history
  • Loading branch information
magnus-tretton37 committed Mar 19, 2019
2 parents 128b574 + 82eba21 commit 7fe9be8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 5 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: '{build}'
skip_branch_with_pr: true
image: Visual Studio 2017
install:
- cmd: cd src
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
- 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
14 changes: 3 additions & 11 deletions src/Castle.Sdk/Infrastructure/HttpMessageSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public HttpMessageSender(CastleConfiguration configuration, IInternalLogger logg
public async Task<TResponse> Post<TResponse>(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
Expand All @@ -58,7 +58,7 @@ public async Task<TResponse> Put<TResponse>(string endpoint)
public async Task<TResponse> Delete<TResponse>(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
Expand Down Expand Up @@ -91,14 +91,6 @@ private async Task<TResponse> SendRequest<TResponse>(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");
}
}
}
}
8 changes: 8 additions & 0 deletions src/Tests/When_creating_configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

0 comments on commit 7fe9be8

Please sign in to comment.