Merge branch 'master' into dev

# Conflicts:
#	PackageTesters/PackageTester.NET45/PackageTester.NET45.csproj
#	PackageTesters/PackageTester.NET45/packages.config
#	PackageTesters/PackageTester.NET461/PackageTester.NET461.csproj
#	PackageTesters/PackageTester.NET461/packages.config
#	PackageTesters/PackageTester.NETCore/PackageTester.NETCore.csproj
This commit is contained in:
Todd Menier 2017-10-09 14:23:11 -05:00
commit a15a98f7bd
9 changed files with 47 additions and 16 deletions

View File

@ -34,8 +34,8 @@
<Reference Include="Flurl, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.5.0\lib\net40\Flurl.dll</HintPath>
</Reference>
<Reference Include="Flurl.Http, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.2.0.0\lib\net45\Flurl.Http.dll</HintPath>
<Reference Include="Flurl.Http, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.2.0.1\lib\net45\Flurl.Http.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.5.0" targetFramework="net45" />
<package id="Flurl.Http" version="2.0.0" targetFramework="net45" />
<package id="Flurl.Http" version="2.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
</packages>

View File

@ -36,8 +36,8 @@
<Reference Include="Flurl, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.5.0\lib\net40\Flurl.dll</HintPath>
</Reference>
<Reference Include="Flurl.Http, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.2.0.0\lib\net45\Flurl.Http.dll</HintPath>
<Reference Include="Flurl.Http, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.2.0.1\lib\net45\Flurl.Http.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.5.0" targetFramework="net461" />
<package id="Flurl.Http" version="2.0.0" targetFramework="net461" />
<package id="Flurl.Http" version="2.0.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
</packages>

View File

@ -8,7 +8,7 @@
<Import Project="..\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
<ItemGroup>
<PackageReference Include="Flurl.Http" Version="2.0.0" />
<PackageReference Include="Flurl.Http" Version="2.0.1" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,27 @@
using Flurl.Http.Configuration;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Test.Http
{
[TestFixture, Parallelizable]
public class DefaultUrlEncodedSerializerTests
{
[Test]
public void can_serialize_object() {
var vals = new {
a = "foo",
b = 333,
c = (string)null, // exlude
d = ""
};
var serialized = new DefaultUrlEncodedSerializer().Serialize(vals);
Assert.AreEqual("a=foo&b=333&d=", serialized);
}
}
}

View File

@ -19,9 +19,13 @@ namespace Flurl.Http.Configuration
return null;
var qp = new QueryParamCollection();
foreach (var kv in obj.ToKeyValuePairs())
qp[kv.Key] = new QueryParameter(kv.Key, kv.Value);
return qp.ToString(true);
foreach (var kv in obj.ToKeyValuePairs())
{
// if value is null, the serializer shouldn't add this key-value pair.
if (kv.Value == null) continue;
qp[kv.Key] = new QueryParameter(kv.Key, kv.Value);
}
return qp.ToString(true);
}
/// <summary>

View File

@ -4,7 +4,7 @@
<TargetFrameworks>net45;netstandard1.3;netstandard1.1;</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>Flurl.Http</PackageId>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<Authors>Todd Menier</Authors>
<Description>WARNING: 2.0 CONTAINS BREAKING CHANGES - REVIEW RELEASE NOTES CAREFULLY! Flurl.Http is a fluent, portable, testable HTTP client library that extends Flurl's URL builder chain.</Description>
<PackageProjectUrl>http://tmenier.github.io/Flurl</PackageProjectUrl>

View File

@ -43,12 +43,12 @@ namespace Flurl.Http
/// <summary>
/// HttpResponseMessage associated with the call if the call completed, otherwise null.
/// </summary>
public HttpResponseMessage Response { get; set; }
public HttpResponseMessage Response { get; internal set; }
/// <summary>
/// Exception that occurred while sending the HttpRequestMessage.
/// </summary>
public Exception Exception { get; set; }
public Exception Exception { get; internal set; }
/// <summary>
/// User code should set this to true inside global event handlers (OnError, etc) to indicate
@ -59,12 +59,12 @@ namespace Flurl.Http
/// <summary>
/// DateTime the moment the request was sent.
/// </summary>
public DateTime StartedUtc { get; set; }
public DateTime StartedUtc { get; internal set; }
/// <summary>
/// DateTime the moment a response was received.
/// </summary>
public DateTime? EndedUtc { get; set; }
public DateTime? EndedUtc { get; internal set; }
/// <summary>
/// Total duration of the call if it completed, otherwise null.
@ -90,7 +90,7 @@ namespace Flurl.Http
/// <summary>
/// Body of the HTTP response if unsuccessful, otherwise null. (Successful responses are not captured as strings, mainly for performance reasons.)
/// </summary>
public string ErrorResponseBody { get; set; }
public string ErrorResponseBody { get; internal set; }
/// <summary>
/// Returns the verb and absolute URI associated with this call.