Skip to content

Commit

Permalink
Fix handling of poorly formatted headers (mosty commonly user-agents)…
Browse files Browse the repository at this point in the history
… in mock message handler.
  • Loading branch information
Troy Willmot committed Oct 17, 2018
1 parent ed1ba83 commit 3b493c9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 15 deletions.
37 changes: 37 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[*]
end_of_line = crlf
indent_size = tab
tab_width = 2

[*.{cs,vb,xml}]
charset = utf-8
dotnet_sort_system_directives_first = true:none
dotnet_style_coalesce_expression = true:none
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_null_propagation = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:none
dotnet_style_predefined_type_for_member_access = false:none
dotnet_style_qualification_for_event = false:none
dotnet_style_qualification_for_field = false:none
dotnet_style_qualification_for_method = false:none
dotnet_style_qualification_for_property = false:none

[*.cs]
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_expression_bodied_accessors = false:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_indexers = false:suggestion
csharp_style_expression_bodied_methods = false:suggestion
csharp_style_expression_bodied_operators = false:suggestion
csharp_style_expression_bodied_properties = false:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_throw_expression = false:none
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_new_line_before_catch = true:none
csharp_new_line_before_else = true:none
csharp_new_line_before_finally = true:none
csharp_new_line_between_query_expression_clauses = true:none
2 changes: 1 addition & 1 deletion src/PublishNugetPackage.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
echo Press any key to publish
pause
".nuget\NuGet.exe" push Yort.Http.ClientPipeline.1.0.0.7.nupkg
".nuget\NuGet.exe" push Yort.Http.ClientPipeline.1.0.0.8.nupkg
pause
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Resources;
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand All @@ -14,7 +14,7 @@
[assembly: AssemblyConfiguration("RELEASE")]
#endif
[assembly: AssemblyProduct("Yort.Http.ClientPipeline")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: CLSCompliant(false)]

// Version information for an assembly consists of the following four values:
Expand All @@ -27,5 +27,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.5")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.5")]
[assembly: AssemblyVersion("1.0.0.8")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.8")]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -163,18 +163,12 @@ private static async Task<HttpResponseMessage> CloneResponse(HttpResponseMessage
private static async Task<HttpRequestMessage> CloneRequest(HttpRequestMessage request)
{
var retVal = new HttpRequestMessage(request.Method, request.RequestUri);
foreach (var header in request.Headers)
{
retVal.Headers.Add(header.Key, header.Value);
}
CopyHeaders(request.Headers, retVal.Headers);

if (request.Content != null)
{
var content = new ByteArrayContent(await request.Content.ReadAsByteArrayAsync().ConfigureAwait(false));
foreach (var header in request.Content.Headers)
{
content.Headers.Add(header.Key, header.Value);
}
CopyHeaders(request.Content.Headers, content.Headers);
retVal.Content = content;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Yort.Http.ClientPipeline.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Yort.Http.ClientPipeline</id>
<version>1.0.0.7</version>
<version>1.0.0.8</version>
<title>Yort.Http.ClientPipeline</title>
<authors>Yortw</authors>
<owners>Yortw</owners>
Expand Down

0 comments on commit 3b493c9

Please sign in to comment.