Merge branch 'dev' of https://github.com/tmenier/Flurl into dev
This commit is contained in:
commit
ac12d88052
11
Flurl.sln
11
Flurl.sln
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.6
|
||||
VisualStudioVersion = 15.0.26430.16
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flurl", "src\Flurl\Flurl.csproj", "{117B6C6E-53F9-45AE-9439-F4FB7E21B116}"
|
||||
EndProject
|
||||
@ -33,12 +33,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageTester.NETCore", "Pa
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.NET45", "PackageTesters\PackageTester.NET45\PackageTester.NET45.csproj", "{AA8792B6-E0FA-46BA-BA03-C7971745F577}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.PCL", "PackageTesters\PackageTester.PCL\PackageTester.PCL.csproj", "{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{7018b9e0-ad5b-42e4-ad35-59f324ed8e56}*SharedItemsImports = 4
|
||||
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{84fb572a-8b77-4b09-b825-2a240bce1b7a}*SharedItemsImports = 4
|
||||
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{aa8792b6-e0fa-46ba-ba03-c7971745f577}*SharedItemsImports = 4
|
||||
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{d4717aa7-5549-4bad-81c5-406844a12990}*SharedItemsImports = 13
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -74,10 +72,6 @@ Global
|
||||
{AA8792B6-E0FA-46BA-BA03-C7971745F577}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA8792B6-E0FA-46BA-BA03-C7971745F577}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA8792B6-E0FA-46BA-BA03-C7971745F577}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -91,6 +85,5 @@ Global
|
||||
{84FB572A-8B77-4B09-B825-2A240BCE1B7A} = {9A136878-A43E-4154-9B5E-EDAF27E8628D}
|
||||
{0231607B-9CA3-4277-9F19-9925694D22E0} = {9A136878-A43E-4154-9B5E-EDAF27E8628D}
|
||||
{AA8792B6-E0FA-46BA-BA03-C7971745F577} = {9A136878-A43E-4154-9B5E-EDAF27E8628D}
|
||||
{7018B9E0-AD5B-42E4-AD35-59F324ED8E56} = {9A136878-A43E-4154-9B5E-EDAF27E8628D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -31,11 +31,11 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Flurl, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.2.4.0-pre\lib\net40\Flurl.dll</HintPath>
|
||||
<Reference Include="Flurl, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.3.0.0\lib\net40\Flurl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Flurl.Http, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.Http.1.2.0-pre\lib\net45\Flurl.Http.dll</HintPath>
|
||||
<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>
|
||||
<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>
|
||||
@ -59,11 +59,6 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PackageTester.PCL\PackageTester.PCL.csproj">
|
||||
<Project>{7018b9e0-ad5b-42e4-ad35-59f324ed8e56}</Project>
|
||||
<Name>PackageTester.PCL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using PackageTester.PCL;
|
||||
|
||||
namespace PackageTester.NET45
|
||||
{
|
||||
@ -7,9 +6,6 @@ namespace PackageTester.NET45
|
||||
{
|
||||
public static void Main(string[] args) {
|
||||
new Tester().DoTestsAsync().Wait();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Testing against PCL...");
|
||||
new PclTester().DoTestsAsync().Wait();
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Flurl" version="2.4.0" targetFramework="net45" />
|
||||
<package id="Flurl.Http" version="1.2.0" targetFramework="net45" />
|
||||
<package id="Flurl" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Flurl.Http" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
</packages>
|
@ -33,11 +33,11 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Flurl, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.2.4.0-pre\lib\net40\Flurl.dll</HintPath>
|
||||
<Reference Include="Flurl, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.3.0.0\lib\net40\Flurl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Flurl.Http, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.Http.1.2.0-pre\lib\net45\Flurl.Http.dll</HintPath>
|
||||
<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>
|
||||
<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>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Flurl" version="2.4.0" targetFramework="net461" />
|
||||
<package id="Flurl.Http" version="1.2.0" targetFramework="net461" />
|
||||
<package id="Flurl" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Flurl.Http" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
|
||||
</packages>
|
@ -8,7 +8,7 @@
|
||||
<Import Project="..\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Flurl.Http" Version="1.2.0-pre" />
|
||||
<PackageReference Include="Flurl.Http" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7018B9E0-AD5B-42E4-AD35-59F324ED8E56}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PackageTester.PCL</RootNamespace>
|
||||
<AssemblyName>PackageTester.PCL</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Flurl, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.2.4.0-pre\lib\net40\Flurl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Flurl.Http, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Flurl.Http.1.2.0-pre\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>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PclTester.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,4 +0,0 @@
|
||||
namespace PackageTester.PCL
|
||||
{
|
||||
public class PclTester : Tester { }
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Flurl" version="2.4.0" targetFramework="net45" />
|
||||
<package id="Flurl.Http" version="1.2.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
</packages>
|
@ -7,7 +7,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.7.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -196,7 +196,7 @@ namespace Flurl.Test.Http
|
||||
}
|
||||
|
||||
// parallel testing not supported in PCL
|
||||
#if !PORTABLE
|
||||
|
||||
[Test]
|
||||
public async Task can_test_in_parallel() {
|
||||
await Task.WhenAll(
|
||||
@ -206,7 +206,6 @@ namespace Flurl.Test.Http
|
||||
CallAndAssertCountAsync(4),
|
||||
CallAndAssertCountAsync(6));
|
||||
}
|
||||
#endif
|
||||
|
||||
private async Task CallAndAssertCountAsync(int calls) {
|
||||
using (var test = new HttpTest()) {
|
||||
|
@ -1,12 +1,14 @@
|
||||
using System.IO;
|
||||
#if NETSTANDARD1_1
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flurl.Http
|
||||
{
|
||||
internal static class FileUtil
|
||||
{
|
||||
#if PORTABLE
|
||||
#if NETSTANDARD1_1
|
||||
internal static string GetFileName(string path) {
|
||||
return path?.Split(PCLStorage.PortablePath.DirectorySeparatorChar).Last();
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net45;netstandard1.3;portable-net45+win8+wpa81+wp8</TargetFrameworks>
|
||||
<TargetFrameworks>net45;netstandard1.3;netstandard1.1;</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>1.2.0</Version>
|
||||
<Version>2.0.0</Version>
|
||||
<Authors>Todd Menier</Authors>
|
||||
<Description>A fluent, portable, testable HTTP client library that extends Flurl's URL builder chain.</Description>
|
||||
<PackageProjectUrl>http://tmenier.github.io/Flurl</PackageProjectUrl>
|
||||
@ -11,8 +11,9 @@
|
||||
<PackageLicenseUrl>https://raw.githubusercontent.com/tmenier/Flurl/master/LICENSE</PackageLicenseUrl>
|
||||
<RepositoryUrl>https://github.com/tmenier/Flurl.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>httpclient rest json http fluent portable url uri tdd assert async</PackageTags>
|
||||
<PackageTags>httpclient rest json http fluent url uri tdd assert async</PackageTags>
|
||||
<PackageReleaseNotes>
|
||||
3.0.0 - Drop PCL target
|
||||
1.2.0 - Up'd solution to VS2017, up'd Flurl dependency to 2.4.0
|
||||
1.1.3 - Minor fixes (github #175, #182, #186)
|
||||
1.1.2 - Minor bug fixes (github #159 & #169), up'd Flurl dependency to 2.3.0
|
||||
@ -48,7 +49,7 @@
|
||||
0.2.0 - Added .NET 4.5 specific version with fewer dependencies.
|
||||
0.1.3 - Added support for HEAD requests via HeadAsync (thanks to @benb1n).
|
||||
</PackageReleaseNotes>
|
||||
<IncludeProjectPriFile>false</IncludeProjectPriFile>
|
||||
<IncludeProjectPriFile>false</IncludeProjectPriFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -61,40 +62,24 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="Flurl" Version="2.4.0" />
|
||||
<PackageReference Include="Flurl" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
|
||||
<DefineConstants>NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
|
||||
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
|
||||
<Reference Include="System.Net.Http" />
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.1'">
|
||||
<PackageReference Include="PCLStorage" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'portable-net45+win8+wpa81+wp8'">
|
||||
<DefineConstants>PORTABLE</DefineConstants>
|
||||
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
|
||||
<NugetTargetMoniker>.NETPortable,Version=v0.0,Profile=Profile259</NugetTargetMoniker>
|
||||
<LanguageTargets>C:\Program Files (x86)\MSBuild\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets</LanguageTargets>
|
||||
<PropertyGroup>
|
||||
<PackageTargetFallback Condition="'$(TargetFramework)'=='netstandard1.1'">portable-net45+win8+wp8</PackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='portable-net45+win8+wpa81+wp8'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<PackageReference Include="Microsoft.Bcl.Async" Version="1.0.168" />
|
||||
<PackageReference Include="Microsoft.Bcl.Build" Version="1.0.21" />
|
||||
<PackageReference Include="Microsoft.Net.Http" Version="2.2.29" />
|
||||
<PackageReference Include="PCLStorage" Version="1.0.2" />
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
#if NETSTANDARD
|
||||
#if NETSTANDARD1_3
|
||||
using System.Text;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
@ -64,7 +64,7 @@ namespace Flurl.Http
|
||||
/// <returns>A Task whose result is the response body as a string.</returns>
|
||||
/// <example>s = await url.PostAsync(data).ReceiveString()</example>
|
||||
public static async Task<string> ReceiveString(this Task<HttpResponseMessage> response) {
|
||||
#if NETSTANDARD
|
||||
#if NETSTANDARD1_3
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
#endif
|
||||
var resp = await response.ConfigureAwait(false);
|
||||
|
@ -4,10 +4,6 @@ namespace Flurl.Http
|
||||
{
|
||||
internal static class NoOpTask
|
||||
{
|
||||
#if !PORTABLE
|
||||
public static readonly Task Instance = Task.FromResult(0);
|
||||
#elif PORTABLE
|
||||
public static readonly Task Instance = TaskEx.FromResult(0);
|
||||
#endif
|
||||
}
|
||||
}
|
@ -144,17 +144,17 @@ namespace Flurl.Http.Testing
|
||||
FlurlHttp.GlobalSettings.ResetDefaults();
|
||||
}
|
||||
|
||||
#if PORTABLE
|
||||
private static HttpTest _test;
|
||||
private static void SetCurrentTest(HttpTest test) => _test = test;
|
||||
private static HttpTest GetCurrentTest() => _test;
|
||||
#elif NET45
|
||||
#if NET45
|
||||
private static void SetCurrentTest(HttpTest test) => System.Runtime.Remoting.Messaging.CallContext.LogicalSetData("FlurlHttpTest", test);
|
||||
private static HttpTest GetCurrentTest() => System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("FlurlHttpTest") as HttpTest;
|
||||
#else
|
||||
#elif NETSTANDARD1_3
|
||||
private static System.Threading.AsyncLocal<HttpTest> _test = new System.Threading.AsyncLocal<HttpTest>();
|
||||
private static void SetCurrentTest(HttpTest test) => _test.Value = test;
|
||||
private static HttpTest GetCurrentTest() => _test.Value;
|
||||
#elif NETSTANDARD1_1
|
||||
private static HttpTest _test;
|
||||
private static void SetCurrentTest(HttpTest test) => _test = test;
|
||||
private static HttpTest GetCurrentTest() => _test;
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net40;netstandard1.3;portable-net40+win8+wpa81+wp8+sl5</TargetFrameworks>
|
||||
<TargetFrameworks>net40;netstandard1.3;netstandard1.0;</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>2.4.0</Version>
|
||||
<Version>3.0.0</Version>
|
||||
<Authors>Todd Menier</Authors>
|
||||
<Description>A fluent, portable URL builder. To make HTTP calls off the fluent chain, check out Flurl.Http.</Description>
|
||||
<PackageProjectUrl>http://tmenier.github.io/Flurl</PackageProjectUrl>
|
||||
@ -11,8 +11,9 @@
|
||||
<PackageLicenseUrl>https://raw.githubusercontent.com/tmenier/Flurl/master/LICENSE</PackageLicenseUrl>
|
||||
<RepositoryUrl>https://github.com/tmenier/Flurl.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>fluent portable url uri querystring builder</PackageTags>
|
||||
<PackageTags>fluent url uri querystring builder</PackageTags>
|
||||
<PackageReleaseNotes>
|
||||
3.0.0 - Drop PCL target
|
||||
2.4.0 - Up'd solution to VS2017, platform targeting fixes (github #176)
|
||||
2.3.0 - First-class support for name-only query parameters (github #164), NullValueHandling config enum
|
||||
2.2.1 - Fix net461 target (github #128)
|
||||
@ -48,26 +49,8 @@
|
||||
<DocumentationFile>bin\Release\Flurl.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'portable-net40+win8+wpa81+wp8+sl5'">
|
||||
<DefineConstants>PORTABLE</DefineConstants>
|
||||
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile328</TargetFrameworkProfile>
|
||||
<NugetTargetMoniker>.NETPortable,Version=v0.0,Profile=Profile328</NugetTargetMoniker>
|
||||
<LanguageTargets>C:\Program Files (x86)\MSBuild\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets</LanguageTargets>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
|
||||
<DefineConstants>NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
|
||||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='portable-net40+win8+wpa81+wp8+sl5'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -3,7 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
#if NETSTANDARD
|
||||
#if !NET40
|
||||
using System.Reflection;
|
||||
#endif
|
||||
|
||||
@ -14,14 +14,14 @@ namespace Flurl.Util
|
||||
/// </summary>
|
||||
public static class CommonExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts an object's public properties to a collection of string-based key-value pairs. If the object happens
|
||||
/// to be an IDictionary, the IDictionary's keys and values converted to strings and returned.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to parse into key-value pairs</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="obj"/> is <see langword="null" />.</exception>
|
||||
public static IEnumerable<KeyValuePair<string, object>> ToKeyValuePairs(this object obj) {
|
||||
/// <summary>
|
||||
/// Converts an object's public properties to a collection of string-based key-value pairs. If the object happens
|
||||
/// to be an IDictionary, the IDictionary's keys and values converted to strings and returned.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to parse into key-value pairs</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="obj"/> is <see langword="null" />.</exception>
|
||||
public static IEnumerable<KeyValuePair<string, object>> ToKeyValuePairs(this object obj) {
|
||||
if (obj == null)
|
||||
throw new ArgumentNullException(nameof(obj));
|
||||
|
||||
@ -37,24 +37,25 @@ namespace Flurl.Util
|
||||
public static string ToInvariantString(this object obj) {
|
||||
// inspired by: http://stackoverflow.com/a/19570016/62600
|
||||
|
||||
#if !NETSTANDARD1_0
|
||||
var c = obj as IConvertible;
|
||||
if (c != null)
|
||||
return c.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
#endif
|
||||
var f = obj as IFormattable;
|
||||
if (f != null)
|
||||
return f.ToString(null, CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
return obj.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Splits at the first occurence of the given seperator.
|
||||
/// </summary>
|
||||
/// <param name="s">The string to split.</param>
|
||||
/// <param name="separator">The separator to split on.</param>
|
||||
/// <returns>Array of at most 2 strings. (1 if separator is not found.)</returns>
|
||||
public static string[] SplitOnFirstOccurence(this string s, char separator) {
|
||||
/// <summary>
|
||||
/// Splits at the first occurence of the given seperator.
|
||||
/// </summary>
|
||||
/// <param name="s">The string to split.</param>
|
||||
/// <param name="separator">The separator to split on.</param>
|
||||
/// <returns>Array of at most 2 strings. (1 if separator is not found.)</returns>
|
||||
public static string[] SplitOnFirstOccurence(this string s, char separator) {
|
||||
// Needed because full PCL profile doesn't support Split(char[], int) (#119)
|
||||
if (string.IsNullOrEmpty(s))
|
||||
return new[] { s };
|
||||
@ -71,9 +72,15 @@ namespace Flurl.Util
|
||||
}
|
||||
|
||||
private static IEnumerable<KeyValuePair<string, object>> ObjectToKV(object obj) {
|
||||
#if NETSTANDARD1_0
|
||||
return from prop in obj.GetType().GetRuntimeProperties()
|
||||
let val = prop.GetValue(obj, null)
|
||||
select new KeyValuePair<string, object>(prop.Name, val);
|
||||
#else
|
||||
return from prop in obj.GetType().GetProperties()
|
||||
let val = prop.GetValue(obj, null)
|
||||
select new KeyValuePair<string, object>(prop.Name, val);
|
||||
#endif
|
||||
}
|
||||
|
||||
private static IEnumerable<KeyValuePair<string, object>> CollectionToKV(IEnumerable col) {
|
||||
@ -86,8 +93,13 @@ namespace Flurl.Util
|
||||
object val;
|
||||
|
||||
var type = item.GetType();
|
||||
#if NETSTANDARD1_0
|
||||
var keyProp = type.GetRuntimeProperty("Key") ?? type.GetRuntimeProperty("key") ?? type.GetRuntimeProperty("Name") ?? type.GetRuntimeProperty("name");
|
||||
var valProp = type.GetRuntimeProperty("Value") ?? type.GetRuntimeProperty("value");
|
||||
#else
|
||||
var keyProp = type.GetProperty("Key") ?? type.GetProperty("key") ?? type.GetProperty("Name") ?? type.GetProperty("name");
|
||||
var valProp = type.GetProperty("Value") ?? type.GetProperty("value");
|
||||
#endif
|
||||
|
||||
if (keyProp != null && valProp != null) {
|
||||
key = keyProp.GetValue(item, null)?.ToInvariantString();
|
||||
|
Loading…
x
Reference in New Issue
Block a user