Skip to content

Commit

Permalink
Merge pull request #387 from MindscapeHQ/webapi-minor-patch-after-merge
Browse files Browse the repository at this point in the history
XRAY-1598: Changes needed to release customer PR.
  • Loading branch information
QuantumNightmare authored Jul 12, 2018
2 parents 637422b + 62fdcf7 commit db75358
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiDelegatingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ namespace Mindscape.Raygun4Net.WebApi
public class RaygunWebApiDelegatingHandler : DelegatingHandler
{
public const string RequestBodyKey = "Raygun.RequestBody";
private const int MaxBytesToCapture = 4096;

protected override async System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
// ReadAsByteArrayAsync is always readable as it calls LoadIntoBufferAsync internally.
var bytes = await request.Content.ReadAsByteArrayAsync();
if (bytes.Length > 0)
if (bytes != null && bytes.Length > 0)
{
// Only take first 4096 bytes
var bytesToSend = bytes.Take(4096).ToArray();
var bytesToSend = bytes.Take(MaxBytesToCapture).ToArray();
request.Properties[RequestBodyKey] = Encoding.UTF8.GetString(bytesToSend);
}

Expand Down
9 changes: 2 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ properties {
$solution_file_webjob = "$root/Mindscape.Raygun4Net.Azure.WebJob.sln"
$solution_file_webapi = "$root/Mindscape.Raygun4Net.WebApi.sln"
$solution_file_winrt = "$root/Mindscape.Raygun4Net.WinRT.sln"
$solution_file_windows_phone = "$root/Mindscape.Raygun4Net.WindowsPhone.sln"
$configuration = "Release"
$build_dir = "$root\build\"
$build_dir_client_profile = "$build_dir\Net3.ClientProfile"
Expand All @@ -25,7 +24,7 @@ properties {
$env:Path += ";$nunit_dir;$tools_dir;$nuget_dir"
}

task default -depends Compile, CompileWinRT, CompileWindowsPhone
task default -depends Compile, CompileWinRT

task Clean {
remove-item -force -recurse $build_dir -ErrorAction SilentlyContinue | Out-Null
Expand Down Expand Up @@ -57,11 +56,7 @@ task CompileWinRT -depends Init {
remove-item -force -recurse $build_dir/Mindscape.Raygun4Net.WinRT.Tests -ErrorAction SilentlyContinue | Out-Null
}

task CompileWindowsPhone -depends Init {
exec { msbuild "$solution_file_windows_phone" /m /p:OutDir=$build_dir /p:Configuration=$Configuration }
}

task Test -depends Compile, CompileWinRT, CompileWindowsPhone, CompileWindowsStore {
task Test -depends Compile, CompileWinRT {
$test_assemblies = Get-ChildItem $build_dir -Include *Tests.dll -Name

Push-Location -Path $build_dir
Expand Down
4 changes: 4 additions & 0 deletions buildWindowsPhone.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set EnableNuGetPackageRestore=true
call .\packages\psake.4.3.2\tools\psake.cmd buildWindowsPhone.ps1 %*

pause
34 changes: 34 additions & 0 deletions buildWindowsPhone.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
properties {
$root = $psake.build_script_dir
$solution_file = "$root/Mindscape.Raygun4Net.WindowsPhone.sln"
$configuration = "Release"
$build_dir = "$root\build\WindowsPhone\"
$nunit_dir = "$root\packages\NUnit.Runners.2.6.2\tools\"
$tools_dir = "$root\tools"
$nuget_dir = "$root\.nuget"
$env:Path += ";$nunit_dir;$tools_dir;$nuget_dir"
}

task default -depends Compile

task Clean {
remove-item -force -recurse $build_dir -ErrorAction SilentlyContinue | Out-Null
}

task Init -depends Clean {
new-item $build_dir -itemType directory | Out-Null
}

task Compile -depends Init {
exec { msbuild "$solution_file" /m /p:OutDir=$build_dir /p:Configuration=$Configuration }
}

task Test -depends Compile {
$test_assemblies = Get-ChildItem $build_dir -Include *Tests.dll -Name

Push-Location -Path $build_dir

exec { nunit-console.exe $test_assemblies }

Pop-Location
}

0 comments on commit db75358

Please sign in to comment.