Merge pull request #88 from tmenier/dev

Dev to master Flurl.Http 1.0.0 and Flurl 2.1.0
This commit is contained in:
Todd Menier 2016-07-17 22:35:08 -05:00 committed by GitHub
commit 840a690f13
145 changed files with 4053 additions and 3381 deletions

5
.gitignore vendored
View File

@ -7,4 +7,7 @@ packages
*.xproj.user
.vs
*.lock.json
*.log
*.log
.vscode
publish
TestResult.xml

View File

@ -1,71 +0,0 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Flurl.Http</id>
<version>0.10.1</version>
<title>Flurl.Http</title>
<authors>Todd Menier</authors>
<projectUrl>http://tmenier.github.io/Flurl</projectUrl>
<iconUrl>https://pbs.twimg.com/profile_images/534024476296376320/IuPGZ_bX_400x400.png</iconUrl>
<licenseUrl>https://raw.githubusercontent.com/tmenier/Flurl/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
A fluent, portable, testable HTTP client library that extends Flurl's URL builder chain.
</description>
<releaseNotes>
0.10.1 - DLL version fix (github #90)
0.10.0 - Lib updates, including Flurl 2.0 which contains breaking changes: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.9.0 - BREAKING CHANGES: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.8.0 - .NET Core support (github #61, thx @kroniak)
0.7.0 - BREAKING CHANGES: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.6.4 - nuspec fix for Xamarin/non-PCL, AllowHttpStatus overloads with HttpStatusCode enum.
0.6.3 - Updated Flurl dependency to 1.0.9.
0.6.2 - Respect Json.NET's JsonConvert.DefaultSettings
0.6.1 - Fixed possibly dictionary lookup bug (github #34).
0.6.0 - Added support for cancellation tokens, PATCH, string request bodies.
0.5.3 - Updated Flurl dependency to 1.0.7.
0.5.2 - Allowed HTTP status at the individual client/call level, i.e. url.AllowHttpStatus("3xx"), url.AllowAnyHttpStatus()
0.5.1 - Configure which HTTP statuses won't throw exceptions, i.e. FlurlHttp.Configure(c => c.AllowedHttpStatusRange = "100-299,4xx");
0.5.0 - Added deserialization helpers for error responses (FlurlHttpException.FlurlHttpException.GetResponseJson, etc).
0.4.2 - Updated Flurl dependency to 1.0.6.
0.4.1 - GitHub #25 - some exceptions not triggering global OnError.
0.4.0 - Client lifetime management - see http://bit.ly/1zqmuLA.
0.3.0 - Added support for sending cookies (WithCookie/WithCookies), including breaking change to IHttpClientFactory.
0.2.5 - Added hook to create HttpClientHandler from custom factory, updated Flurl dependency.
0.2.4 - Updated Flurl dependency for PCL to 1.0.2.
0.2.3 - New properties added to HttpCall: Url, Completed, Succeeded, HttpStatus.
0.2.2 - Updated Flurl dependency for PCL to 1.0.1.
0.2.1 - Added support for getting streams and byte arrays.
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).
</releaseNotes>
<tags>httpclient rest json http fluent portable url uri tdd assert async</tags>
<dependencies>
<group targetFramework="net45">
<dependency id="Newtonsoft.Json" version="8.0.3" />
<dependency id="Flurl" version="2.0.0" />
</group>
<group targetFramework="portable-net45+win+wpa81+wp80">
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Net.Http" version="2.2.22" />
<dependency id="PCLStorage" version="1.0.2" />
<dependency id="Newtonsoft.Json" version="8.0.3" />
<dependency id="Flurl" version="2.0.0" />
</group>
<group targetFramework=".NETPlatform5.4">
<dependency id="Flurl" version="2.0.0" />
<dependency id="Newtonsoft.Json" version="8.0.3" />
<dependency id="System.Dynamic.Runtime" version="4.0.10" />
<dependency id="System.IO.FileSystem" version="4.0.0" />
<dependency id="System.Net.Http" version="4.0.0" />
<dependency id="System.Text.RegularExpressions" version="4.0.10" />
<dependency id="System.Threading" version="4.0.10" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\Flurl.Http.NET45\bin\Release\Flurl.Http.*" target="lib\net45" />
<file src="..\Flurl.Http.PCL\bin\Release\Flurl.Http.*" target="lib\portable-net45+win+wpa81+wp80" />
<file src="..\artifacts\bin\Flurl.Http\Release\dotnet5.4\Flurl.Http.*" target="lib\dotnet5.4" />
</files>
</package>

Binary file not shown.

View File

@ -1,9 +0,0 @@
@echo off
set workDir=%1
set publishSpec=%2
set publishDir=%3
cd %workDir%
if not exist "%publishDir%" mkdir "%publishDir%"
call NuGet.exe pack %publishSpec% -OutputDirectory %publishDir%

13
Build/build.cmd Normal file
View File

@ -0,0 +1,13 @@
@call dotnet --info
@call build.flurl.cmd
@if ERRORLEVEL 1 (
echo Error! Build Flurl failed.
exit /b 1
)
@call build.flurl.http.cmd
@if ERRORLEVEL 1 (
echo Error! Build Flurl.Http failed.
exit /b 1
)

11
Build/build.flurl.cmd Normal file
View File

@ -0,0 +1,11 @@
@set project=..\src\Flurl.Library\
call dotnet restore --verbosity Error %project%
@if ERRORLEVEL 1 (
echo Error! Restoring dependicies failed.
exit /b 1
) else (
echo Restoring dependicies was successful.
)
call dotnet build -c Release %project%

View File

@ -0,0 +1,27 @@
@set project=..\src\Flurl.Http.CodeGen\
call dotnet restore --verbosity Error %project%
@if ERRORLEVEL 1 (
echo Error! Restoring dependicies failed.
exit /b 1
) else (
echo Restoring dependicies was successful.
)
call dotnet run -c Release -p %project% ..\src\Flurl.Http.Shared\HttpExtensions.cs
@if ERRORLEVEL 1 (
echo Error! Generation cs file failed.
exit /b 1
)
@set project=..\src\Flurl.Http.Library\
call dotnet restore --verbosity Error %project%
@if ERRORLEVEL 1 (
echo Error! Restoring dependicies failed.
exit /b 1
) else (
echo Restoring dependicies was successful.
)
call dotnet build -c Release %project%

View File

@ -0,0 +1,116 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Flurl.Http</id>
<version>1.0.0</version>
<title>Flurl.Http</title>
<authors>Todd Menier</authors>
<projectUrl>http://tmenier.github.io/Flurl</projectUrl>
<iconUrl>https://pbs.twimg.com/profile_images/534024476296376320/IuPGZ_bX_400x400.png</iconUrl>
<licenseUrl>https://raw.githubusercontent.com/tmenier/Flurl/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
A fluent, portable, testable HTTP client library that extends Flurl's URL builder chain.
</description>
<releaseNotes>
1.0.0 - Many updates and new features: https://github.com/tmenier/Flurl/releases/tag/Flurl.Http.1.0.0
0.10.1 - DLL version fix (github #90)
0.10.0 - Lib updates, including Flurl 2.0 which contains breaking changes: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.9.0 - BREAKING CHANGES: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.8.0 - .NET Core support (github #61, thx @kroniak)
0.7.0 - BREAKING CHANGES: https://github.com/tmenier/Flurl/wiki/Release-Notes
0.6.4 - nuspec fix for Xamarin/non-PCL, AllowHttpStatus overloads with HttpStatusCode enum.
0.6.3 - Updated Flurl dependency to 1.0.9.
0.6.2 - Respect Json.NET's JsonConvert.DefaultSettings
0.6.1 - Fixed possibly dictionary lookup bug (github #34).
0.6.0 - Added support for cancellation tokens, PATCH, string request bodies.
0.5.3 - Updated Flurl dependency to 1.0.7.
0.5.2 - Allowed HTTP status at the individual client/call level, i.e. url.AllowHttpStatus("3xx"), url.AllowAnyHttpStatus()
0.5.1 - Configure which HTTP statuses won't throw exceptions, i.e. FlurlHttp.Configure(c => c.AllowedHttpStatusRange = "100-299,4xx");
0.5.0 - Added deserialization helpers for error responses (FlurlHttpException.FlurlHttpException.GetResponseJson, etc).
0.4.2 - Updated Flurl dependency to 1.0.6.
0.4.1 - GitHub #25 - some exceptions not triggering global OnError.
0.4.0 - Client lifetime management - see http://bit.ly/1zqmuLA.
0.3.0 - Added support for sending cookies (WithCookie/WithCookies), including breaking change to IHttpClientFactory.
0.2.5 - Added hook to create HttpClientHandler from custom factory, updated Flurl dependency.
0.2.4 - Updated Flurl dependency for PCL to 1.0.2.
0.2.3 - New properties added to HttpCall: Url, Completed, Succeeded, HttpStatus.
0.2.2 - Updated Flurl dependency for PCL to 1.0.1.
0.2.1 - Added support for getting streams and byte arrays.
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).
</releaseNotes>
<tags>httpclient rest json http fluent portable url uri tdd assert async</tags>
<dependencies>
<group targetFramework="net45">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
</group>
<group targetFramework="net461">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="System.IO.FileSystem" version="4.0.1" />
<dependency id="System.Net.Http" version="4.1.0" />
<dependency id="System.Text.Encoding.CodePages" version="4.0.1" />
</group>
<group targetFramework="monoandroid">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl.Build" version="1.0.21" />
<dependency id="Microsoft.Net.Http" version="2.2.29" />
<dependency id="PCLStorage" version="1.0.2" />
</group>
<group targetFramework="monotouch">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl.Build" version="1.0.21" />
<dependency id="Microsoft.Net.Http" version="2.2.29" />
<dependency id="PCLStorage" version="1.0.2" />
</group>
<group targetFramework="xamarin.ios">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl.Build" version="1.0.21" />
<dependency id="Microsoft.Net.Http" version="2.2.29" />
<dependency id="PCLStorage" version="1.0.2" />
</group>
<group targetFramework="xamarin.mac">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl.Build" version="1.0.21" />
<dependency id="Microsoft.Net.Http" version="2.2.29" />
<dependency id="PCLStorage" version="1.0.2" />
</group>
<group targetFramework="portable45-net45+win8+wpa81">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="Microsoft.Bcl.Async" version="1.0.168" />
<dependency id="Microsoft.Bcl.Build" version="1.0.21" />
<dependency id="Microsoft.Net.Http" version="2.2.29" />
<dependency id="PCLStorage" version="1.0.2" />
</group>
<group targetFramework="uap10">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
</group>
<group targetFramework="netstandard1.4">
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="Flurl" version="2.1.0" />
<dependency id="System.IO.FileSystem" version="4.0.1" />
<dependency id="System.Net.Http" version="4.1.0" />
<dependency id="System.Text.Encoding.CodePages" version="4.0.1" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\..\src\Flurl.Http.Library\bin\Release\portable45-net45+win8+wpa81\Flurl.Http.*" target="lib\monoandroid" />
<file src="..\..\src\Flurl.Http.Library\bin\Release\portable45-net45+win8+wpa81\Flurl.Http.*" target="lib\monotouch" />
<file src="..\..\src\Flurl.Http.Library\bin\Release\portable45-net45+win8+wpa81\Flurl.Http.*" target="lib\xamarin.ios" />
<file src="..\..\src\Flurl.Http.Library\bin\Release\portable45-net45+win8+wpa81\Flurl.Http.*" target="lib\xamarin.mac" />
<file src="..\..\src\Flurl.Http.Library\bin\Release\**\Flurl.Http.*" target="lib\" />
</files>
</package>

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<package >
<metadata>
<id>Flurl</id>
<version>2.0.0</version>
<version>2.1.0</version>
<title>Flurl</title>
<authors>Todd Menier</authors>
<projectUrl>http://tmenier.github.io/Flurl</projectUrl>
@ -13,6 +13,7 @@
A fluent, portable URL builder. To make HTTP calls off the fluent chain, check out Flurl.Http.
</description>
<releaseNotes>
2.1.0 - .NET Core 1.0.0 support. Target .NET Platform Standard 1.4
2.0.0 - BREAKING CHANGES: https://github.com/tmenier/Flurl/wiki/Release-Notes
1.1.2 - Fix net461 target (github #74)
1.1.1 - Packaging fix
@ -34,14 +35,27 @@
</releaseNotes>
<tags>fluent portable url uri querystring builder</tags>
<dependencies>
<group targetFramework=".NETPlatform5.4">
<dependency id="System.Linq" version="4.0.0" />
<dependency id="System.Reflection.TypeExtensions" version="4.0.0" />
<group targetFramework="net40" />
<group targetFramework="win8" />
<group targetFramework="wpa81" />
<group targetFramework="xamarin.ios" />
<group targetFramework="xamarin.mac" />
<group targetFramework="monotouch" />
<group targetFramework="monoandroid" />
<group targetFramework="uap10" />
<group targetFramework="portable40-net40+win8+wpa81" />
<group targetFramework="netstandard1.4">
<dependency id="System.Globalization.Calendars" version="4.0.1" />
<dependency id="System.Linq" version="4.1.0" />
<dependency id="System.Reflection.TypeExtensions" version="4.1.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\Flurl\bin\Release\Flurl.*" target="lib\portable-net40+win+wpa81+wp80+MonoAndroid10+MonoTouch10" />
<file src="..\artifacts\bin\Flurl\Release\dotnet5.4\Flurl.*" target="lib\dotnet5.4" />
<file src="..\..\src\Flurl.Library\bin\Release\portable40-net40+win8+wpa81\Flurl.*" target="lib\monoandroid" />
<file src="..\..\src\Flurl.Library\bin\Release\portable40-net40+win8+wpa81\Flurl.*" target="lib\monotouch" />
<file src="..\..\src\Flurl.Library\bin\Release\portable40-net40+win8+wpa81\Flurl.*" target="lib\xamarin.ios" />
<file src="..\..\src\Flurl.Library\bin\Release\portable40-net40+win8+wpa81\Flurl.*" target="lib\xamarin.mac" />
<file src="..\..\src\Flurl.Library\bin\Release\**\Flurl.*" target="lib\" />
</files>
</package>

13
Build/pack.flurl.cmd Normal file
View File

@ -0,0 +1,13 @@
@call build.flurl.cmd
@if ERRORLEVEL 1 (
echo Error! Build Flurl failed.
exit /b 1
)
@md publish > nul 2>&1
@call nuget.exe pack nuspec\Flurl.nuspec -OutputDirectory publish
@if ERRORLEVEL 1 (
echo Error! Packing Flurl failed.
exit /b 1
)

13
Build/pack.flurl.http.cmd Normal file
View File

@ -0,0 +1,13 @@
@call build.flurl.http.cmd
@if ERRORLEVEL 1 (
echo Error! Build Flurl.Http failed.
exit /b 1
)
@md publish > nul 2>&1
@call nuget.exe pack nuspec\Flurl.http.nuspec -OutputDirectory publish
@if ERRORLEVEL 1 (
echo Error! Packing Flurl.Http failed.
exit /b 1
)

358
Build/scripts/install.ps1 Normal file
View File

@ -0,0 +1,358 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
<#
.SYNOPSIS
Installs dotnet cli
.DESCRIPTION
Installs dotnet cli. If dotnet installation already exists in the given directory
it will update it only if the requested version differs from the one already installed.
.PARAMETER Channel
Default: preview
Channel is the way of reasoning about stability and quality of dotnet. This parameter takes one of the values:
- future - Possibly unstable, frequently changing, may contain new finished and unfinished features
- preview - Pre-release stable with known issues and feature gaps
- production - Most stable releases
.PARAMETER Version
Default: latest
Represents a build version on specific channel. Possible values:
- 4-part version in a format A.B.C.D - represents specific version of build
- latest - most latest build on specific channel
- lkg - last known good version on specific channel
Note: LKG work is in progress. Once the work is finished, this will become new default
.PARAMETER InstallDir
Default: %LocalAppData%\Microsoft\dotnet
Path to where to install dotnet. Note that binaries will be placed directly in a given directory.
.PARAMETER Architecture
Default: <auto> - this value represents currently running OS architecture
Architecture of dotnet binaries to be installed.
Possible values are: <auto>, x64 and x86
.PARAMETER SharedRuntime
Default: false
Installs just the shared runtime bits, not the entire SDK
.PARAMETER DebugSymbols
If set the installer will include symbols in the installation.
.PARAMETER DryRun
If set it will not perform installation but instead display what command line to use to consistently install
currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link
with specific version so that this command can be used deterministicly in a build script.
It also displays binaries location if you prefer to install or download it yourself.
.PARAMETER NoPath
By default this script will set environment variable PATH for the current process to the binaries folder inside installation folder.
If set it will display binaries location but not set any environment variable.
.PARAMETER Verbose
Displays diagnostics information.
.PARAMETER AzureFeed
Default: https://dotnetcli.blob.core.windows.net/dotnet
This parameter should not be usually changed by user. It allows to change URL for the Azure feed used by this installer.
#>
[cmdletbinding()]
param(
[string]$Channel="rel-1.0.0",
[string]$Version="Latest",
[string]$InstallDir="<auto>",
[string]$Architecture="<auto>",
[switch]$SharedRuntime,
[switch]$DebugSymbols, # TODO: Switch does not work yet. Symbols zip is not being uploaded yet.
[switch]$DryRun,
[switch]$NoPath,
[string]$AzureFeed="https://dotnetcli.blob.core.windows.net/dotnet"
)
Set-StrictMode -Version Latest
$ErrorActionPreference="Stop"
$ProgressPreference="SilentlyContinue"
$BinFolderRelativePath=""
# example path with regex: shared/1.0.0-beta-12345/somepath
$VersionRegEx="/\d+\.\d+[^/]+/"
$OverrideNonVersionedFiles=$true
function Say($str) {
Write-Host "dotnet-install: $str"
}
function Say-Verbose($str) {
Write-Verbose "dotnet-install: $str"
}
function Say-Invocation($Invocation) {
$command = $Invocation.MyCommand;
$args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ")
Say-Verbose "$command $args"
}
function Get-Machine-Architecture() {
Say-Invocation $MyInvocation
# possible values: AMD64, IA64, x86
return $ENV:PROCESSOR_ARCHITECTURE
}
# TODO: Architecture and CLIArchitecture should be unified
function Get-CLIArchitecture-From-Architecture([string]$Architecture) {
Say-Invocation $MyInvocation
switch ($Architecture.ToLower()) {
{ $_ -eq "<auto>" } { return Get-CLIArchitecture-From-Architecture $(Get-Machine-Architecture) }
{ ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" }
{ $_ -eq "x86" } { return "x86" }
default { throw "Architecture not supported. If you think this is a bug, please report it at https://github.com/dotnet/cli/issues" }
}
}
function Get-Version-Info-From-Version-Text([string]$VersionText) {
Say-Invocation $MyInvocation
$Data = @($VersionText.Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
$VersionInfo = @{}
$VersionInfo.CommitHash = $Data[0].Trim()
$VersionInfo.Version = $Data[1].Trim()
return $VersionInfo
}
function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) {
Say-Invocation $MyInvocation
$VersionFileUrl = $null
if ($SharedRuntime) {
$VersionFileUrl = "$AzureFeed/$AzureChannel/dnvm/latest.sharedfx.win.$CLIArchitecture.version"
}
else {
$VersionFileUrl = "$AzureFeed/Sdk/$AzureChannel/latest.version"
}
$Response = Invoke-WebRequest -UseBasicParsing $VersionFileUrl
switch ($Response.Headers.'Content-Type'){
{ ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($Response.Content) }
{ ($_ -eq "text/plain") } { $VersionText = $Response.Content }
default { throw "``$Response.Headers.'Content-Type'`` is an unknown .version file content type." }
}
$VersionInfo = Get-Version-Info-From-Version-Text $VersionText
return $VersionInfo
}
# TODO: AzureChannel and Channel should be unified
function Get-Azure-Channel-From-Channel([string]$Channel) {
Say-Invocation $MyInvocation
# For compatibility with build scripts accept also directly Azure channels names
switch ($Channel.ToLower()) {
{ ($_ -eq "future") -or ($_ -eq "dev") } { return "dev" }
{ $_ -eq "production" } { throw "Production channel does not exist yet" }
default { return $_ }
}
}
function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture, [string]$Version) {
Say-Invocation $MyInvocation
switch ($Version.ToLower()) {
{ $_ -eq "latest" } {
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture
return $LatestVersionInfo.Version
}
{ $_ -eq "lkg" } { throw "``-Version LKG`` not supported yet." }
default { return $Version }
}
}
function Get-Download-Links([string]$AzureFeed, [string]$AzureChannel, [string]$SpecificVersion, [string]$CLIArchitecture) {
Say-Invocation $MyInvocation
$ret = @()
if ($SharedRuntime) {
$PayloadURL = "$AzureFeed/$AzureChannel/Binaries/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip"
}
else {
$PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip"
}
Say-Verbose "Constructed payload URL: $PayloadURL"
$ret += $PayloadURL
return $ret
}
function Get-User-Share-Path() {
Say-Invocation $MyInvocation
$InstallRoot = $env:DOTNET_INSTALL_DIR
if (!$InstallRoot) {
$InstallRoot = "$env:LocalAppData\Microsoft\dotnet"
}
return $InstallRoot
}
function Resolve-Installation-Path([string]$InstallDir) {
Say-Invocation $MyInvocation
if ($InstallDir -eq "<auto>") {
return Get-User-Share-Path
}
return $InstallDir
}
function Get-Version-Info-From-Version-File([string]$InstallRoot, [string]$RelativePathToVersionFile) {
Say-Invocation $MyInvocation
$VersionFile = Join-Path -Path $InstallRoot -ChildPath $RelativePathToVersionFile
Say-Verbose "Local version file: $VersionFile"
if (Test-Path $VersionFile) {
$VersionText = cat $VersionFile
Say-Verbose "Local version file text: $VersionText"
return Get-Version-Info-From-Version-Text $VersionText
}
Say-Verbose "Local version file not found."
return $null
}
function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePathToPackage, [string]$SpecificVersion) {
Say-Invocation $MyInvocation
$DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion
Say-Verbose "Is-Dotnet-Package-Installed: Path to a package: $DotnetPackagePath"
return Test-Path $DotnetPackagePath -PathType Container
}
function Get-Absolute-Path([string]$RelativeOrAbsolutePath) {
# Too much spam
# Say-Invocation $MyInvocation
return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RelativeOrAbsolutePath)
}
function Get-Path-Prefix-With-Version($path) {
$match = [regex]::match($path, $VersionRegEx)
if ($match.Success) {
return $entry.FullName.Substring(0, $match.Index + $match.Length)
}
return $null
}
function Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package([System.IO.Compression.ZipArchive]$Zip, [string]$OutPath) {
Say-Invocation $MyInvocation
$ret = @()
foreach ($entry in $Zip.Entries) {
$dir = Get-Path-Prefix-With-Version $entry.FullName
if ($dir -ne $null) {
$path = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $dir)
if (-Not (Test-Path $path -PathType Container)) {
$ret += $dir
}
}
}
$ret = $ret | Sort-Object | Get-Unique
$values = ($ret | foreach { "$_" }) -join ";"
Say-Verbose "Directories to unpack: $values"
return $ret
}
# Example zip content and extraction algorithm:
# Rule: files if extracted are always being extracted to the same relative path locally
# .\
# a.exe # file does not exist locally, extract
# b.dll # file exists locally, override only if $OverrideFiles set
# aaa\ # same rules as for files
# ...
# abc\1.0.0\ # directory contains version and exists locally
# ... # do not extract content under versioned part
# abc\asd\ # same rules as for files
# ...
# def\ghi\1.0.1\ # directory contains version and does not exist locally
# ... # extract content
function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) {
Say-Invocation $MyInvocation
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
Set-Variable -Name Zip
try {
$Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipPath)
$DirectoriesToUnpack = Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip $Zip -OutPath $OutPath
foreach ($entry in $Zip.Entries) {
$PathWithVersion = Get-Path-Prefix-With-Version $entry.FullName
if (($PathWithVersion -eq $null) -Or ($DirectoriesToUnpack -contains $PathWithVersion)) {
$DestinationPath = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $entry.FullName)
$DestinationDir = Split-Path -Parent $DestinationPath
$OverrideFiles=$OverrideNonVersionedFiles -Or (-Not (Test-Path $DestinationPath))
if ((-Not $DestinationPath.EndsWith("\")) -And $OverrideFiles) {
New-Item -ItemType Directory -Force -Path $DestinationDir | Out-Null
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $DestinationPath, $OverrideNonVersionedFiles)
}
}
}
}
finally {
if ($Zip -ne $null) {
$Zip.Dispose()
}
}
}
$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture
$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version
$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -AzureChannel $AzureChannel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture
if ($DryRun) {
Say "Payload URLs:"
foreach ($DownloadLink in $DownloadLinks) {
Say "- $DownloadLink"
}
Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir"
exit 0
}
$InstallRoot = Resolve-Installation-Path $InstallDir
Say-Verbose "InstallRoot: $InstallRoot"
$IsSdkInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage "sdk" -SpecificVersion $SpecificVersion
Say-Verbose ".NET SDK installed? $IsSdkInstalled"
if ($IsSdkInstalled) {
Say ".NET SDK version $SpecificVersion is already installed."
exit 0
}
New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null
foreach ($DownloadLink in $DownloadLinks) {
$ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink"
$resp = Invoke-WebRequest -UseBasicParsing $DownloadLink -OutFile $ZipPath
Say "Extracting zip from $DownloadLink"
Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot
Remove-Item $ZipPath
}
$BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath $BinFolderRelativePath)
if (-Not $NoPath) {
Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process."
$env:path = "$BinPath;" + $env:path
}
else {
Say "Binaries of dotnet can be found in $BinPath"
}
Say "Installation finished"
exit 0

View File

@ -0,0 +1,9 @@
if (Get-Command dotnet -errorAction SilentlyContinue) {
Write-Host "Using dotnet '$((Get-Command dotnet).Path)'"
dotnet --version
}
else {
Write-Host "dotnet.exe not found"
}

13
Build/test.cmd Normal file
View File

@ -0,0 +1,13 @@
@set project=..\test\Flurl.Test.NETCore\
@call dotnet --info
call dotnet restore --verbosity Error %project%
@if ERRORLEVEL 1 (
echo Error! Restoring dependicies failed.
exit /b 1
) else (
echo Restoring dependicies was successful.
)
call dotnet test -c Release %project%

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Http.CodeGen
{
/// <summary>
/// Wraps a StreamWriter. Mainly just keeps track of indentation.
/// </summary>
public class CodeWriter : IDisposable
{
private readonly StreamWriter _sw;
private int _indent = 0;
private bool _wrapping = false;
public CodeWriter(string filePath) {
_sw = new StreamWriter(filePath);
}
/// <summary>
/// use @0, @1, @2, etc for tokens. ({0} would be a pain because you'd alway need to escape "{" and "}")
/// </summary>
public CodeWriter WriteLine(string line, params object[] args) {
line = line.Trim();
for (int i = 0; i < args.Length; i++) {
var val = (args[i] == null) ? "" : args[i].ToString();
line = line.Replace("@" + i, val);
}
if (line == "}" || line == "{") {
_indent--;
}
_sw.Write(new String('\t', _indent));
_sw.WriteLine(line);
if (line == "" || line.StartsWith("//") || line.EndsWith("]")) {
_wrapping = false;
}
else if (line.EndsWith(";") || line.EndsWith("}")) {
if (_wrapping) _indent--;
_wrapping = false;
}
else if (line.EndsWith("{")) {
_indent++;
_wrapping = false;
}
else {
if (!_wrapping) _indent++;
_wrapping = true;
}
return this; // fluent!
}
public CodeWriter WriteLine() {
_sw.WriteLine();
return this;
}
public void Dispose() {
_sw.Dispose();
}
}
}

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{0571F8FF-1649-433C-97F3-7341942AC886}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flurl.Http.CodeGen</RootNamespace>
<AssemblyName>Flurl.Http.CodeGen</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<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="CodeWriter.cs" />
<Compile Include="ExtensionMethodModel.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,89 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Http.CodeGen
{
class Program
{
static void Main(string[] args) {
if (args.Length == 0)
throw new ArgumentException("Must provide a path to the .cs output file.");
var codePath = args[0];
using (var writer = new CodeWriter(codePath)) {
writer
.WriteLine("// This file was auto-generated by Flurl.Http.CodeGen. Do not edit directly.")
.WriteLine()
.WriteLine("using System.Collections.Generic;")
.WriteLine("using System.IO;")
.WriteLine("using System.Net.Http;")
.WriteLine("using System.Threading;")
.WriteLine("using System.Threading.Tasks;")
.WriteLine("using Flurl.Http.Content;")
.WriteLine("")
.WriteLine("namespace Flurl.Http")
.WriteLine("{")
.WriteLine("public static class HttpExtensions")
.WriteLine("{");
WriteExtensionMethods(writer);
writer
.WriteLine("}")
.WriteLine("}");
}
}
private static void WriteExtensionMethods(CodeWriter writer) {
foreach (var xm in ExtensionMethodModel.GetAll()) {
writer.WriteLine("/// <summary>");
var summaryStart = (xm.ExtentionOfType == "FlurlClient") ? "Sends" : "Creates a FlurlClient from the URL and sends";
writer.WriteLine("/// @0 an asynchronous @1 request.", summaryStart, xm.HttpVerb.ToUpperInvariant());
writer.WriteLine("/// </summary>");
if (xm.BodyType != null)
writer.WriteLine("/// <param name=\"data\">Contents of the request body.</param>");
if (xm.HasCancelationToken)
writer.WriteLine("/// <param name=\"cancellationToken\">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>");
writer.WriteLine("/// <returns>A Task whose result is @0.</returns>", xm.ReturnTypeDescription);
var args = new List<string>();
args.Add("this " + xm.ExtentionOfType + (xm.ExtentionOfType == "FlurlClient" ? " client" : " url"));
if (xm.BodyType != null)
args.Add((xm.BodyType == "String" ? "string" : "object") + " data");
if (xm.HasCancelationToken)
args.Add("CancellationToken cancellationToken");
writer.WriteLine("public static Task<@0> @1@2(@3) {", xm.TaskArg, xm.Name, xm.IsGeneric ? "<T>" : "", string.Join(", ", args));
if (xm.ExtentionOfType == "FlurlClient") {
if (xm.BodyType != null) {
writer.WriteLine("var content = new Captured@0Content(@1);",
xm.BodyType,
xm.BodyType == "String" ? "data" : string.Format("client.Settings.{0}Serializer.Serialize(data)", xm.BodyType));
}
args.Clear();
args.Add(xm.HttpVerb == "Patch" ? "new HttpMethod(\"PATCH\")" : "HttpMethod." + xm.HttpVerb); // there's no HttpMethod.Patch
if (xm.BodyType != null)
args.Add("content: content");
if (xm.HasCancelationToken)
args.Add("cancellationToken: cancellationToken");
var client = (xm.ExtentionOfType == "FlurlClient") ? "client" : "new FlurlClient(url, false)";
var receive = (xm.DeserializeToType == null) ? "" : string.Format(".Receive{0}{1}()", xm.DeserializeToType, xm.IsGeneric ? "<T>" : "");
writer.WriteLine("return @0.SendAsync(@1)@2;", client, string.Join(", ", args), receive);
}
else {
writer.WriteLine("return new FlurlClient(url, false).@0(@1);",
xm.Name + (xm.IsGeneric ? "<T>" : ""),
string.Join(", ", args.Skip(1).Select(a => a.Split(' ').Last())));
}
writer.WriteLine("}").WriteLine();
}
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Flurl.Http.CodeGen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Flurl.Http.CodeGen")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ad34a4a2-e63a-492e-9b24-8907c1da92c8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flurl.Http</RootNamespace>
<AssemblyName>Flurl.Http</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</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>
</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>
<DocumentationFile>bin\Release\Flurl.Http.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.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="DownloadExtensions.cs" />
<Compile Include="NoOpTask.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Flurl\Flurl.csproj">
<Project>{70a34167-759e-4902-82e0-e6a84c2ce46f}</Project>
<Name>Flurl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="..\Flurl.Http.Shared\Flurl.Http.Shared.projitems" Label="Shared" Condition="Exists('..\Flurl.Http.Shared\Flurl.Http.Shared.projitems')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>"$(SolutionDir)Flurl.Http.CodeGen\bin\$(ConfigurationName)\Flurl.Http.CodeGen.exe" "$(SolutionDir)Flurl.Http.Shared\HttpExtensions.cs"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Http
{
internal static class NoOpTask
{
public static readonly Task Instance = Task.FromResult(0);
}
}

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
</packages>

View File

@ -1,71 +0,0 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using PCLStorage;
namespace Flurl.Http
{
public static class DownloadExtensions
{
/// <summary>
/// Asynchronously downloads a file at the specified URL.
/// </summary>
/// <param name="localFolderPath">Path of local folder where file is to be downloaded.</param>
/// <param name="localFileName">Name of local file. If not specified, the source filename (last segment of the URL) is used.</param>
/// <param name="bufferSize">Buffer size in bytes. Default is 4096.</param>
/// <returns>A Task whose result is the local path of the downloaded file.</returns>
public static async Task<string> DownloadFileAsync(this FlurlClient client, string localFolderPath, string localFileName = null, int bufferSize = 4096) {
if (localFileName == null)
localFileName = client.Url.Path.Split('/').Last();
var folder = await EnsureFolderAsync(localFolderPath).ConfigureAwait(false);
var file = await folder.CreateFileAsync(localFileName, CreationCollisionOption.ReplaceExisting).ConfigureAwait(false);
// need to temporarily disable autodispose if set, otherwise reading from stream will fail
var autoDispose = client.AutoDispose;
client.AutoDispose = false;
try {
var response = await client.SendAsync(HttpMethod.Get, completionOption: HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
// http://codereview.stackexchange.com/a/18679
using (var httpStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
using (var filestream = await file.OpenAsync(FileAccess.ReadAndWrite).ConfigureAwait(false)) {
await httpStream.CopyToAsync(filestream, bufferSize).ConfigureAwait(false);
}
return PortablePath.Combine(localFolderPath, localFileName);
}
finally {
client.AutoDispose = autoDispose;
if (client.AutoDispose) client.Dispose();
}
}
/// <summary>
/// Asynchronously downloads a file at the specified URL.
/// </summary>
/// <param name="localFolderPath">Path of local folder where file is to be downloaded.</param>
/// <param name="localFileName">Name of local file. If not specified, the source filename (last segment of the URL) is used.</param>
/// <param name="bufferSize">Buffer size in bytes. Default is 4096.</param>
/// <returns>A Task whose result is the local path of the downloaded file.</returns>
public static Task<string> DownloadFileAsync(this string url, string localFolderPath, string localFileName = null, int bufferSize = 4096) {
return new FlurlClient(url, true).DownloadFileAsync(localFolderPath, localFileName, bufferSize);
}
/// <summary>
/// Asynchronously downloads a file at the specified URL.
/// </summary>
/// <param name="localFolderPath">Path of local folder where file is to be downloaded.</param>
/// <param name="localFileName">Name of local file. If not specified, the source filename (last segment of the URL) is used.</param>
/// <param name="bufferSize">Buffer size in bytes. Default is 4096.</param>
/// <returns>A Task whose result is the local path of the downloaded file.</returns>
public static Task<string> DownloadFileAsync(this Url url, string localFolderPath, string localFileName = null, int bufferSize = 4096) {
return new FlurlClient(url, true).DownloadFileAsync(localFolderPath, localFileName, bufferSize);
}
private static Task<IFolder> EnsureFolderAsync(string path) {
return FileSystem.Current.LocalStorage.CreateFolderAsync(path, CreationCollisionOption.OpenIfExists);
}
}
}

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4C163DD1-318A-42C0-ACF2-9E0D766D8900}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flurl.Http</RootNamespace>
<AssemblyName>Flurl.Http</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile344</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>2a114409</NuGetPackageImportStamp>
</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>
</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>
<DocumentationFile>bin\Release\Flurl.Http.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="DownloadExtensions.cs" />
<Compile Include="NoOpTask.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net40+sl4+win8+wp71+wpa81\Microsoft.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net40+sl4+win8+wp71+wpa81\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<HintPath>..\packages\PCLStorage.1.0.2\lib\portable-net45+sl5+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac\PCLStorage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<HintPath>..\packages\PCLStorage.1.0.2\lib\portable-net45+sl5+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac\PCLStorage.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\portable-net40+sl5+win8+wp8+wpa81\System.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Flurl\Flurl.csproj">
<Project>{70a34167-759e-4902-82e0-e6a84c2ce46f}</Project>
<Name>Flurl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="..\Flurl.Http.Shared\Flurl.Http.Shared.projitems" Label="Shared" Condition="Exists('..\Flurl.Http.Shared\Flurl.Http.Shared.projitems')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (
call $(SolutionDir)Build\publish.cmd $(SolutionDir)Build\ Flurl.Http.nuspec $(SolutionDir)Publish &gt;&gt; $(SolutionDir)Build\publish.log
)</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Http
{
internal static class NoOpTask
{
public static readonly Task Instance = TaskEx.FromResult(0);
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="portable-win+net45+wp80" requireReinstallation="True" />
<package id="PCLStorage" version="1.0.2" targetFramework="portable40-net45+sl5+win8+wp8+wpa81" />
</packages>

View File

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Flurl.Util;
namespace Flurl.Http.Configuration
{
/// <summary>
/// ISerializer implementation that converts an object representing name/value pairs to a URL-encoded string.
/// Default serializer used in calls to PostUrlEncodedAsync, etc.
/// </summary>
public class DefaultUrlEncodedSerializer : ISerializer
{
public string Serialize(object obj) {
var sb = new StringBuilder();
foreach (var kv in obj.ToKeyValuePairs()) {
if (kv.Value == null)
continue;
if (sb.Length > 0)
sb.Append('&');
sb.Append(Url.EncodeQueryParamValue(kv.Key, true));
sb.Append('=');
sb.Append(Url.EncodeQueryParamValue(kv.Value, true));
}
return sb.ToString();
}
public T Deserialize<T>(string s) {
throw new NotImplementedException("Deserializing to UrlEncoded not supported.");
}
public T Deserialize<T>(Stream stream) {
throw new NotImplementedException("Deserializing to UrlEncoded not supported.");
}
}
}

View File

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Newtonsoft.Json;
namespace Flurl.Http.Configuration
{
/// <summary>
/// ISerializer implementation that uses Newtonsoft Json.NET.
/// Default serializer used in calls to GetJsonAsync, PostJsonAsync, etc.
/// </summary>
public class NewtonsoftJsonSerializer : ISerializer
{
private readonly JsonSerializerSettings _settings;
public NewtonsoftJsonSerializer(JsonSerializerSettings settings) {
_settings = settings;
}
public string Serialize(object obj) {
return JsonConvert.SerializeObject(obj, _settings);
}
public T Deserialize<T>(string s) {
return JsonConvert.DeserializeObject<T>(s, _settings);
}
public T Deserialize<T>(Stream stream) {
// http://james.newtonking.com/json/help/index.html?topic=html/Performance.htm
using (var sr = new StreamReader(stream))
using (var jr = new JsonTextReader(sr)) {
return JsonSerializer.CreateDefault(_settings).Deserialize<T>(jr);
}
}
}
}

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
namespace Flurl.Http.Content
{
/// <summary>
/// Provides HTTP content based on object serialized to URL-encoded name-value, with the with the captured to a property
/// so it can be read without affecting the read-once content stream.
/// </summary>
public class CapturedUrlEncodedContent : CapturedStringContent
{
public CapturedUrlEncodedContent(string data) : base(data) {
this.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
}
}
}

View File

@ -1,150 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using Flurl.Util;
namespace Flurl.Http
{
public static class CookieExtensions
{
/// <summary>
/// Gets a collection of cookies that will be sent in calls using this client. (Use FlurlClient.WithCookie/WithCookies to set cookies.)
/// </summary>
public static Dictionary<string, Cookie> GetCookies(this FlurlClient client) {
return GetCookieContainer(client)?.GetCookies(client.HttpClient.BaseAddress).Cast<Cookie>().ToDictionary(c => c.Name, c => c);
}
/// <summary>
/// Allows cookies to be sent and received in calls made with this client. Not necessary to call when setting cookies via WithCookie/WithCookies.
/// </summary>
public static FlurlClient EnableCookies(this FlurlClient client) {
GetCookieContainer(client); // ensures the container has been created
return client;
}
/// <summary>
/// Allows cookies to be sent and received in calls made to this Url. Not necessary to call when setting cookies via WithCookie/WithCookies.
/// </summary>
public static FlurlClient EnableCookies(this Url url) {
return new FlurlClient(url).EnableCookies();
}
/// <summary>
/// Allows cookies to be sent and received in calls made to this Url. Not necessary to call when setting cookies via WithCookie/WithCookies.
/// </summary>
public static FlurlClient EnableCookies(this string url) {
return new FlurlClient(url).EnableCookies();
}
/// <summary>
/// Sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookie">the cookie to set.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this FlurlClient client, Cookie cookie) {
GetCookieContainer(client).Add(client.HttpClient.BaseAddress, cookie);
return client;
}
/// <summary>
/// Creates a FlurlClient from the URL and sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookie">the cookie to set.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this string url, Cookie cookie) {
return new FlurlClient(url, true).WithCookie(cookie);
}
/// <summary>
/// Creates a FlurlClient from the URL and sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookie">the cookie to set.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this Url url, Cookie cookie) {
return new FlurlClient(url, true).WithCookie(cookie);
}
/// <summary>
/// Sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="name">cookie name.</param>
/// <param name="value">cookie value.</param>
/// <param name="expires">cookie expiration (optional). If excluded, cookie only lives for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this FlurlClient client, string name, object value, DateTime? expires = null) {
return client.WithCookie(new Cookie(name, (value == null) ? null : value.ToInvariantString()) { Expires = expires ?? DateTime.MinValue });
}
/// <summary>
/// Creates a FlurlClient from the URL and sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="name">cookie name.</param>
/// <param name="value">cookie value.</param>
/// <param name="expires">cookie expiration (optional). If excluded, cookie only lives for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this string url, string name, object value, DateTime? expires = null) {
return new FlurlClient(url, true).WithCookie(name, value, expires);
}
/// <summary>
/// Creates a FlurlClient from the URL and sets an HTTP cookie to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="name">cookie name.</param>
/// <param name="value">cookie value.</param>
/// <param name="expires">cookie expiration (optional). If excluded, cookie only lives for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookie(this Url url, string name, object value, DateTime? expires = null) {
return new FlurlClient(url, true).WithCookie(name, value, expires);
}
/// <summary>
/// Sets HTTP cookies based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookies">Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary.</param>
/// <param name="expires">Expiration for all cookies (optional). If excluded, cookies only live for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookies(this FlurlClient client, object cookies, DateTime? expires = null) {
if (cookies == null)
return client;
foreach (var kv in cookies.ToKeyValuePairs())
client.WithCookie(kv.Key, kv.Value, expires);
return client;
}
/// <summary>
/// Creates a FlurlClient from the URL and sets HTTP cookies based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookies">Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary.</param>
/// <param name="expires">Expiration for all cookies (optional). If excluded, cookies only live for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookies(this Url url, object cookies, DateTime? expires = null) {
return new FlurlClient(url, true).WithCookies(cookies);
}
/// <summary>
/// Creates a FlurlClient from the URL and sets HTTP cookies based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent with all requests made with this FlurlClient.
/// </summary>
/// <param name="cookies">Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary.</param>
/// <param name="expires">Expiration for all cookies (optional). If excluded, cookies only live for duration of session.</param>
/// <returns>The modified FlurlClient.</returns>
public static FlurlClient WithCookies(this string url, object cookies, DateTime? expires = null) {
return new FlurlClient(url, true).WithCookies(cookies);
}
private static CookieContainer GetCookieContainer(FlurlClient client) {
var handler = client.HttpMessageHandler as HttpClientHandler;
if (handler == null)
return null;
if (client.HttpClient.BaseAddress == null)
client.HttpClient.BaseAddress = new Uri(Url.GetRoot(client.Url));
return handler.CookieContainer ?? (handler.CookieContainer = new CookieContainer());
}
}
}

View File

@ -1,44 +0,0 @@
using System;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
namespace Flurl.Http
{
public static class HttpStatusRangeParser
{
public static bool IsMatch(string pattern, HttpStatusCode value) {
return IsMatch(pattern, (int)value);
}
public static bool IsMatch(string pattern, int value) {
if (pattern == null)
return false;
foreach (var range in pattern.Split(',').Select(p => p.Trim())) {
if (range == "")
continue;
if (range == "*")
return true; // special case - allow everything
var bounds = range.Split('-');
int lower = 0, upper = 0;
var valid =
bounds.Length <= 2 &&
int.TryParse(Regex.Replace(bounds.First().Trim(), "[*xX]", "0"), out lower) &&
int.TryParse(Regex.Replace(bounds.Last().Trim(), "[*xX]", "9"), out upper);
if (!valid) {
throw new ArgumentException(string.Format(
"Invalid range pattern: \"{0}\". Examples of allowed patterns: \"400\", \"4xx\", \"300,400-403\", \"*\".", pattern));
}
if (value >= lower && value <= upper)
return true;
}
return false;
}
}
}

View File

@ -1,6 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("Flurl.Http")]
[assembly: AssemblyDescription("A fluent, testable, wrist-friendly HTTP client library.")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
[assembly: AssemblyVersion("0.10.1")]

View File

@ -1,109 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using Flurl.Http.Content;
namespace Flurl.Http.Testing
{
/// <summary>
/// An object whose existence puts Flurl.Http into test mode where actual HTTP calls are faked. Provides a response
/// queue, call log, and assertion helpers for use in Arrange/Act/Assert style tests.
/// </summary>
public class HttpTest : IDisposable
{
private static readonly HttpResponseMessage _emptyResponse = new HttpResponseMessage {
StatusCode = HttpStatusCode.OK,
Content = new StringContent("")
};
public HttpTest() {
FlurlHttp.Configure(settings => {
settings.HttpClientFactory = new TestHttpClientFactory(this);
settings.AfterCall = call => CallLog.Add(call);
});
ResponseQueue = new Queue<HttpResponseMessage>();
CallLog = new List<HttpCall>();
}
/// <summary>
/// Adds an HttpResponseMessage to the response queue with the given HTTP status code and content body.
/// </summary>
public HttpTest RespondWith(int status, string body) {
ResponseQueue.Enqueue(new HttpResponseMessage {
StatusCode = (HttpStatusCode)status,
Content = new StringContent(body)
});
return this;
}
/// <summary>
/// Adds an HttpResponseMessage to the response queue with a 200 (OK) status code and the given content body.
/// </summary>
public HttpTest RespondWith(string body) {
return RespondWith(200, body);
}
/// <summary>
/// Adds an HttpResponseMessage to the response queue with the given HTTP status code and the given data serialized to JSON as the content body.
/// </summary>
public HttpTest RespondWithJson(int status, object data) {
ResponseQueue.Enqueue(new HttpResponseMessage {
StatusCode = (HttpStatusCode)status,
Content = new CapturedJsonContent(FlurlHttp.GlobalSettings.JsonSerializer.Serialize(data))
});
return this;
}
/// <summary>
/// Adds an HttpResponseMessage to the response queue with a 200 (OK) status code and the given data serialized to JSON as the content body.
/// </summary>
public HttpTest RespondWithJson(object data) {
return RespondWithJson(200, data);
}
/// <summary>
/// Adds a simulated timeout response to the response queue.
/// </summary>
/// <returns></returns>
public HttpTest SimulateTimeout() {
ResponseQueue.Enqueue(new TimeoutResponseMessage());
return this;
}
/// <summary>
/// Queue of HttpResponseMessages to be returned in place of real responses during testing.
/// </summary>
public Queue<HttpResponseMessage> ResponseQueue { get; set; }
internal HttpResponseMessage GetNextResponse() {
return ResponseQueue.Any() ? ResponseQueue.Dequeue() : _emptyResponse;
}
/// <summary>
/// List of all (fake) HTTP calls made since this HttpTest was created.
/// </summary>
public List<HttpCall> CallLog { get; private set; }
/// <summary>
/// Throws an HttpCallAssertException if a URL matching the given pattern was not called.
/// </summary>
/// <param name="urlPattern">URL that should have been called. Can include * wildcard character.</param>
public HttpCallAssertion ShouldHaveCalled(string urlPattern) {
return new HttpCallAssertion(this.CallLog, false).WithUrlPattern(urlPattern);
}
/// <summary>
/// Throws an HttpCallAssertException if a URL matching the given pattern was called.
/// </summary>
/// <param name="urlPattern">URL that should not have been called. Can include * wildcard character.</param>
public HttpCallAssertion ShouldNotHaveCalled(string urlPattern) {
return new HttpCallAssertion(this.CallLog, true).WithUrlPattern(urlPattern);
}
public void Dispose() {
FlurlHttp.GlobalSettings.ResetDefaults();
}
}
}

340
Flurl.sln
View File

@ -3,76 +3,60 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EB46FFA3-B1A5-4137-8B5F-8CC9F7422A12}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CF0659E1-9C0D-4D35-8FBA-CC5E94619853}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Flurl.Test.Shared", "test\Flurl.Test.Shared\Flurl.Test.Shared.shproj", "{4C7C0861-84F6-436E-8FA6-4C318B336A7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Test.NET45", "test\Flurl.Test.NET45\Flurl.Test.NET45.csproj", "{3F6BE828-FA29-429E-99E1-F1FCDFDC1205}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Test.PCL", "test\Flurl.Test.PCL\Flurl.Test.PCL.csproj", "{49CB777F-D13D-401A-9206-48A6B2ECB276}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl.Http.Library", "src\Flurl.Http.Library\Flurl.Http.Library.xproj", "{52C8C00D-9BD2-4642-B103-F0A8C564FE05}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl.Library", "src\Flurl.Library\Flurl.Library.xproj", "{52CE5E08-8F02-4F75-8B64-8E00E3262A0F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packageTesters", "packageTesters", "{FA115433-6141-4A60-B3F2-8A5972632B50}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PackageTester.NETCore", "packageTesters\PackageTester.NETCore\PackageTester.NETCore.xproj", "{037B6DCC-8249-474C-AD60-60DE9E917EDC}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Flurl.Http.Shared", "src\Flurl.Http.Shared\Flurl.Http.Shared.shproj", "{734E6962-97E2-4318-9A2D-C87E76921AFB}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Flurl.Shared", "src\Flurl.Shared\Flurl.Shared.shproj", "{ED944C76-9613-474E-9861-54E41A3E77CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2E0F19CD-3A0D-42BF-8F85-85B113FD546C}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PackageTester.Shared", "packageTesters\PackageTester.Shared\PackageTester.Shared.shproj", "{19C1BEFD-9DF7-4EFA-9D7D-37B0DC6EEF54}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl.Http.CodeGen", "src\Flurl.Http.CodeGen\Flurl.Http.CodeGen.xproj", "{D27D66C8-240D-4B7F-A9FE-B10E237668A1}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl.Test.NETCore", "Test\Flurl.Test.NETCore\Flurl.Test.NETCore.xproj", "{57899B31-5054-411E-B89B-AC949EA244AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.NET45", "packageTesters\PackageTester.NET45\PackageTester.NET45.csproj", "{48AE832A-29C0-4778-94A4-31E2F6E10805}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.PCL", "packageTesters\PackageTester.PCL\PackageTester.PCL.csproj", "{0A32978C-BC48-4DFB-B1F7-B88541B0D686}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.NET461", "PackageTesters\PackageTester.NET461\PackageTester.NET461.csproj", "{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspec", "nuspec", "{E41F6027-C2B2-4A30-BEBA-A6B059D7DFF4}"
ProjectSection(SolutionItems) = preProject
Build\Flurl.Http.nuspec = Build\Flurl.Http.nuspec
Build\Flurl.nuspec = Build\Flurl.nuspec
global.json = global.json
NuGet.Config = NuGet.Config
README.md = README.md
Build\nuspec\Flurl.Http.nuspec = Build\nuspec\Flurl.Http.nuspec
Build\nuspec\Flurl.nuspec = Build\nuspec\Flurl.nuspec
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Flurl.Http.Shared", "Flurl.Http.Shared\Flurl.Http.Shared.shproj", "{734E6962-97E2-4318-9A2D-C87E76921AFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Http.NET45", "Flurl.Http.NET45\Flurl.Http.NET45.csproj", "{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}"
ProjectSection(ProjectDependencies) = postProject
{0571F8FF-1649-433C-97F3-7341942AC886} = {0571F8FF-1649-433C-97F3-7341942AC886}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl", "Flurl\Flurl.csproj", "{70A34167-759E-4902-82E0-E6A84C2CE46F}"
ProjectSection(ProjectDependencies) = postProject
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F} = {52CE5E08-8F02-4F75-8B64-8E00E3262A0F}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Http.PCL", "Flurl.Http.PCL\Flurl.Http.PCL.csproj", "{4C163DD1-318A-42C0-ACF2-9E0D766D8900}"
ProjectSection(ProjectDependencies) = postProject
{52C8C00D-9BD2-4642-B103-F0A8C564FE05} = {52C8C00D-9BD2-4642-B103-F0A8C564FE05}
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9} = {E7001E27-E952-4E1A-A391-B14ADAE2A1A9}
{0571F8FF-1649-433C-97F3-7341942AC886} = {0571F8FF-1649-433C-97F3-7341942AC886}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CF0659E1-9C0D-4D35-8FBA-CC5E94619853}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Flurl.Test.Shared", "Test\Flurl.Test.Shared\Flurl.Test.Shared.shproj", "{4C7C0861-84F6-436E-8FA6-4C318B336A7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Test.NET45", "Test\Flurl.Test.NET45\Flurl.Test.NET45.csproj", "{3F6BE828-FA29-429E-99E1-F1FCDFDC1205}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Test.PCL", "Test\Flurl.Test.PCL\Flurl.Test.PCL.csproj", "{49CB777F-D13D-401A-9206-48A6B2ECB276}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flurl.Http.CodeGen", "Flurl.Http.CodeGen\Flurl.Http.CodeGen.csproj", "{0571F8FF-1649-433C-97F3-7341942AC886}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl.Http", "NETCore\Flurl.Http\Flurl.Http.xproj", "{52C8C00D-9BD2-4642-B103-F0A8C564FE05}"
ProjectSection(ProjectDependencies) = postProject
{70A34167-759E-4902-82E0-E6A84C2CE46F} = {70A34167-759E-4902-82E0-E6A84C2CE46F}
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Flurl", "NETCore\Flurl\Flurl.xproj", "{52CE5E08-8F02-4F75-8B64-8E00E3262A0F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageTesters", "PackageTesters", "{FA115433-6141-4A60-B3F2-8A5972632B50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.PCL", "PackageTesters\PackageTester.PCL\PackageTester.PCL.csproj", "{0A32978C-BC48-4DFB-B1F7-B88541B0D686}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "PackageTester.Shared", "PackageTesters\PackageTester.Shared\PackageTester.Shared.shproj", "{19C1BEFD-9DF7-4EFA-9D7D-37B0DC6EEF54}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "PackageTester.NETCore", "PackageTesters\PackageTester.NETCore\PackageTester.NETCore.xproj", "{037B6DCC-8249-474C-AD60-60DE9E917EDC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.NET45", "PackageTesters\PackageTester.NET45\PackageTester.NET45.csproj", "{48AE832A-29C0-4778-94A4-31E2F6E10805}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NETCore", "NETCore", "{765DDE74-AF5A-4297-BADE-0D985D31A85A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageTester.NET461", "PackageTester.NET461\PackageTester.NET461.csproj", "{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Test\Flurl.Test.Shared\Flurl.Test.Shared.projitems*{4c7c0861-84f6-436e-8fa6-4c318b336a7b}*SharedItemsImports = 13
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{19c1befd-9df7-4efa-9d7d-37b0dc6eef54}*SharedItemsImports = 13
Flurl.Http.Shared\Flurl.Http.Shared.projitems*{e7001e27-e952-4e1a-a391-b14adae2a1a9}*SharedItemsImports = 4
src\Flurl.Http.Shared\Flurl.Http.Shared.projitems*{49cb777f-d13d-401a-9206-48a6b2ecb276}*SharedItemsImports = 4
Test\Flurl.Test.Shared\Flurl.Test.Shared.projitems*{49cb777f-d13d-401a-9206-48a6b2ecb276}*SharedItemsImports = 4
Flurl.Http.Shared\Flurl.Http.Shared.projitems*{4c163dd1-318a-42c0-acf2-9e0d766d8900}*SharedItemsImports = 4
src\Flurl.Shared\Flurl.Shared.projitems*{49cb777f-d13d-401a-9206-48a6b2ecb276}*SharedItemsImports = 4
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{d00a7c13-ab11-46f0-a694-8986dec6ac5d}*SharedItemsImports = 4
PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems*{0a32978c-bc48-4dfb-b1f7-b88541b0d686}*SharedItemsImports = 4
Flurl.Http.Shared\Flurl.Http.Shared.projitems*{734e6962-97e2-4318-9a2d-c87e76921afb}*SharedItemsImports = 13
src\Flurl.Http.Shared\Flurl.Http.Shared.projitems*{734e6962-97e2-4318-9a2d-c87e76921afb}*SharedItemsImports = 13
src\Flurl.Shared\Flurl.Shared.projitems*{ed944c76-9613-474e-9861-54e41a3e77cd}*SharedItemsImports = 13
src\Flurl.Http.Shared\Flurl.Http.Shared.projitems*{3f6be828-fa29-429e-99e1-f1fcdfdc1205}*SharedItemsImports = 4
Test\Flurl.Test.Shared\Flurl.Test.Shared.projitems*{3f6be828-fa29-429e-99e1-f1fcdfdc1205}*SharedItemsImports = 4
src\Flurl.Shared\Flurl.Shared.projitems*{3f6be828-fa29-429e-99e1-f1fcdfdc1205}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -93,78 +77,6 @@ Global
Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|Any CPU.Build.0 = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|Any CPU.Build.0 = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|iPhone.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E7001E27-E952-4E1A-A391-B14ADAE2A1A9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|Any CPU.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|Any CPU.Build.0 = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|iPhone.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{70A34167-759E-4902-82E0-E6A84C2CE46F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|Any CPU.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|Any CPU.Build.0 = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|iPhone.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4C163DD1-318A-42C0-ACF2-9E0D766D8900}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3F6BE828-FA29-429E-99E1-F1FCDFDC1205}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{3F6BE828-FA29-429E-99E1-F1FCDFDC1205}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{3F6BE828-FA29-429E-99E1-F1FCDFDC1205}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
@ -213,30 +125,6 @@ Global
{49CB777F-D13D-401A-9206-48A6B2ECB276}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{49CB777F-D13D-401A-9206-48A6B2ECB276}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{49CB777F-D13D-401A-9206-48A6B2ECB276}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|Any CPU.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|Any CPU.Build.0 = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|iPhone.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0571F8FF-1649-433C-97F3-7341942AC886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{52C8C00D-9BD2-4642-B103-F0A8C564FE05}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{52C8C00D-9BD2-4642-B103-F0A8C564FE05}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{52C8C00D-9BD2-4642-B103-F0A8C564FE05}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
@ -301,36 +189,6 @@ Global
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhone.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
@ -361,6 +219,70 @@ Global
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{037B6DCC-8249-474C-AD60-60DE9E917EDC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|iPhone.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.AppStore|Mixed Platforms.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|iPhone.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|Any CPU.Build.0 = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|iPhone.ActiveCfg = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|iPhone.Build.0 = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D27D66C8-240D-4B7F-A9FE-B10E237668A1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|iPhone.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|Mixed Platforms.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.AppStore|Mixed Platforms.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|iPhone.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|Any CPU.Build.0 = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|iPhone.ActiveCfg = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|iPhone.Build.0 = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{57899B31-5054-411E-B89B-AC949EA244AC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
@ -384,6 +306,7 @@ Global
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|Any CPU.Build.0 = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|iPhone.ActiveCfg = Release|Any CPU
@ -391,6 +314,39 @@ Global
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{48AE832A-29C0-4778-94A4-31E2F6E10805}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhone.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Any CPU.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhone.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhone.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A32978C-BC48-4DFB-B1F7-B88541B0D686}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
@ -414,6 +370,7 @@ Global
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|Any CPU.Build.0 = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|iPhone.ActiveCfg = Release|Any CPU
@ -421,6 +378,7 @@ Global
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -429,12 +387,16 @@ Global
{4C7C0861-84F6-436E-8FA6-4C318B336A7B} = {CF0659E1-9C0D-4D35-8FBA-CC5E94619853}
{3F6BE828-FA29-429E-99E1-F1FCDFDC1205} = {CF0659E1-9C0D-4D35-8FBA-CC5E94619853}
{49CB777F-D13D-401A-9206-48A6B2ECB276} = {CF0659E1-9C0D-4D35-8FBA-CC5E94619853}
{52C8C00D-9BD2-4642-B103-F0A8C564FE05} = {765DDE74-AF5A-4297-BADE-0D985D31A85A}
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F} = {765DDE74-AF5A-4297-BADE-0D985D31A85A}
{0A32978C-BC48-4DFB-B1F7-B88541B0D686} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{19C1BEFD-9DF7-4EFA-9D7D-37B0DC6EEF54} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{52C8C00D-9BD2-4642-B103-F0A8C564FE05} = {2E0F19CD-3A0D-42BF-8F85-85B113FD546C}
{52CE5E08-8F02-4F75-8B64-8E00E3262A0F} = {2E0F19CD-3A0D-42BF-8F85-85B113FD546C}
{037B6DCC-8249-474C-AD60-60DE9E917EDC} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{734E6962-97E2-4318-9A2D-C87E76921AFB} = {2E0F19CD-3A0D-42BF-8F85-85B113FD546C}
{ED944C76-9613-474E-9861-54E41A3E77CD} = {2E0F19CD-3A0D-42BF-8F85-85B113FD546C}
{19C1BEFD-9DF7-4EFA-9D7D-37B0DC6EEF54} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{D27D66C8-240D-4B7F-A9FE-B10E237668A1} = {2E0F19CD-3A0D-42BF-8F85-85B113FD546C}
{57899B31-5054-411E-B89B-AC949EA244AC} = {CF0659E1-9C0D-4D35-8FBA-CC5E94619853}
{48AE832A-29C0-4778-94A4-31E2F6E10805} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{0A32978C-BC48-4DFB-B1F7-B88541B0D686} = {FA115433-6141-4A60-B3F2-8A5972632B50}
{D00A7C13-AB11-46F0-A694-8986DEC6AC5D} = {FA115433-6141-4A60-B3F2-8A5972632B50}
EndGlobalSection
EndGlobal

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" 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)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{70A34167-759E-4902-82E0-E6A84C2CE46F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flurl</RootNamespace>
<AssemblyName>Flurl</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Profile92</TargetFrameworkProfile>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
</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>
<DocumentationFile>bin\Debug\Flurl.XML</DocumentationFile>
</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>
<DocumentationFile>bin\Release\Flurl.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="QueryParameter.cs" />
<Compile Include="Util\CommonExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QueryParamCollection.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Url.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<PropertyGroup>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (
call $(SolutionDir)Build\publish.cmd $(SolutionDir)Build\ Flurl.nuspec $(SolutionDir)Publish &gt;&gt; $(SolutionDir)Build\publish.log
)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,6 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("Flurl")]
[assembly: AssemblyDescription("A fluent, portable URL builder.")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
[assembly: AssemblyVersion("2.0.0")]

View File

@ -1,32 +0,0 @@
{
"title": "Flurl.Http",
"version": "0.10.1",
"dependencies": {
"Flurl": "2.0.0",
"Newtonsoft.Json": "8.0.3"
},
"compile": [ "../../Flurl.Http.Shared/**/*.cs", "../../Flurl.Http.NET45/**/*.cs" ],
"compileExclude": [ "../../**/AssemblyInfo.cs" ],
"configurations": {
"Release": {
"compilationOptions": {
"optimize": true
}
}
},
"frameworks": {
"dotnet54": {
"dependencies": {
"System.Dynamic.Runtime": "4.0.10",
"System.IO.FileSystem": "4.0.0",
"System.Net.Http": "4.0.0",
"System.Text.RegularExpressions": "4.0.10",
"System.Threading": "4.0.10"
}
}
}
}

View File

@ -1,24 +0,0 @@
{
"title": "Flurl",
"version": "2.0.0",
"compile": [ "../../Flurl/**/*.cs" ],
"compileExclude": [ "../../**/AssemblyInfo.cs" ],
"configurations": {
"Release": {
"compilationOptions": {
"optimize": true
}
}
},
"frameworks": {
"dotnet54": {
"dependencies": {
"System.Linq": "4.0.0",
"System.Reflection.TypeExtensions": "4.0.0"
}
}
}
}

View File

@ -4,6 +4,7 @@
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="flurl feed" value="https://www.myget.org/F/flurl/api/v3/index.json" />
</packageSources>
<disabledPackageSources>
<add key="Microsoft and .NET" value="true" />

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PackageTester
{
class Net461Tester : Tester { }
}

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PackageTester.NET461</RootNamespace>
<AssemblyName>PackageTester.NET461</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Flurl, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Flurl.2.0.0\lib\dotnet5.4\Flurl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Flurl.Http, Version=0.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Flurl.Http.0.10.0\lib\net45\Flurl.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.0.0\lib\net46\System.Reflection.TypeExtensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Net461Tester.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="..\PackageTesters\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PackageTester.NET461
{
class Program
{
static void Main(string[] args) {
TestAllPlatformsAsync().Wait();
Console.ReadLine();
}
private static async Task TestAllPlatformsAsync() {
Cleanup();
await new Net461Tester().DoTestsAsync(Console.WriteLine);
Cleanup();
}
private static void Cleanup() {
var file = "c:\\flurl\\google.txt";
if (File.Exists(file)) File.Delete(file);
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PackageTester.NET461")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PackageTester.NET461")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d00a7c13-ab11-46f0-a694-8986dec6ac5d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.0.0" targetFramework="net461" />
<package id="Flurl.Http" version="0.10.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
<package id="System.Linq" version="4.0.0" targetFramework="net461" />
<package id="System.Reflection" version="4.0.10" targetFramework="net461" />
<package id="System.Reflection.TypeExtensions" version="4.0.0" targetFramework="net461" />
<package id="System.Runtime" version="4.0.20" targetFramework="net461" />
</packages>

View File

@ -13,6 +13,10 @@
<assemblyIdentity name="PCLStorage" publicKeyToken="286fe515a2c35b64" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.2.0" newVersion="1.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PackageTester
namespace PackageTester.NET45
{
class Net45Tester : Tester { }
}
public class Net45Tester : Tester { }
}

View File

@ -36,35 +36,55 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Flurl, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.0.0\lib\portable-net40+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Flurl.dll</HintPath>
<Reference Include="Flurl, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.1.0\lib\portable40-net40+win8+wpa81\Flurl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Flurl.Http, Version=0.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.0.10.0\lib\net45\Flurl.Http.dll</HintPath>
<Reference Include="Flurl.Http, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.1.0.0\lib\net45\Flurl.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<HintPath>..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
<HintPath>..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
</ItemGroup>
<ItemGroup>
<Compile Include="Net45Tester.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageTester.PCL\PackageTester.PCL.csproj">
@ -72,7 +92,22 @@
<Name>PackageTester.PCL</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PackageTester.PCL;
namespace PackageTester
namespace PackageTester.NET45
{
class Program
public class Program
{
static void Main(string[] args) {
public static void Main(string[] args) {
TestAllPlatformsAsync().Wait();
Console.ReadLine();
}
@ -23,8 +21,8 @@ namespace PackageTester
}
private static void Cleanup() {
var file = "c:\\flurl\\google.txt";
var file = "c:\\google.txt";
if (File.Exists(file)) File.Delete(file);
}
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PackageTester.NET45")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PackageTester.NET45")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("48ae832a-29c0-4778-94a4-31e2f6e10805")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.0.0" targetFramework="net45" />
<package id="Flurl.Http" version="0.10.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="Flurl" version="2.1.0" targetFramework="net45" />
<package id="Flurl.Http" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="PCLStorage" version="1.0.2" targetFramework="net45" />
</packages>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.X509Certificates" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Win32.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,4 @@
namespace PackageTester.NET461
{
public class Net461Tester : Tester { }
}

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{D00A7C13-AB11-46F0-A694-8986DEC6AC5D}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PackageTester.NET461</RootNamespace>
<AssemblyName>PackageTester.NET461</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Flurl, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.1.0\lib\netstandard1.4\Flurl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Flurl.Http, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.1.0.0\lib\net45\Flurl.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Win32.Primitives.4.0.1\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.0.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.FileSystem.4.0.1\lib\net46\System.IO.FileSystem.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Net.Http.4.1.0\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.2.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.0.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.0.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.1.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.Encoding.CodePages, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Text.Encoding.CodePages.4.0.1\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Net461Tester.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="..\PackageTester.Shared\PackageTester.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,29 @@
using System;
using System.IO;
using System.Threading.Tasks;
namespace PackageTester.NET461
{
public class Program
{
public static void Main(string[] args)
{
TestAllPlatformsAsync().Wait();
Console.ReadLine();
}
private static async Task TestAllPlatformsAsync()
{
Cleanup();
await new Net461Tester().DoTestsAsync(Console.WriteLine);
Cleanup();
}
private static void Cleanup()
{
var file = "c:\\google.txt";
if (File.Exists(file))
File.Delete(file);
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.1.0" targetFramework="net461" />
<package id="Flurl.Http" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.0.0" targetFramework="net461" />
<package id="System.IO.FileSystem" version="4.0.1" targetFramework="net461" />
<package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="net461" />
<package id="System.Net.Http" version="4.1.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="net461" />
<package id="System.Text.Encoding.CodePages" version="4.0.1" targetFramework="net461" />
</packages>

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PackageTester
namespace PackageTester
{
public class NetCoreTester : Tester { }
}
}

View File

@ -4,15 +4,16 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>037b6dcc-8249-474c-ad60-60de9e917edc</ProjectGuid>
<RootNamespace>PackageTester</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace PackageTester
{
public class Program
{
static void Main(string[] args) {
Cleanup();
new NetCoreTester().DoTestsAsync(Console.WriteLine).Wait();
Cleanup();
Console.ReadLine();
}
public static void Main(string[] args)
{
Cleanup();
new NetCoreTester().DoTestsAsync(Console.WriteLine).Wait();
Cleanup();
Console.ReadLine();
}
private static void Cleanup() {
var file = "c:\\flurl\\google.txt";
if (File.Exists(file)) File.Delete(file);
}
}
}
private static void Cleanup()
{
var file = "c:\\google.txt";
if (File.Exists(file))
File.Delete(file);
}
}
}

View File

@ -1,23 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PackageTester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PackageTester")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("037b6dcc-8249-474c-ad60-60de9e917edc")]

View File

@ -1,31 +1,21 @@
{
"version": "1.0.0-*",
"description": "PackageTester Console Application",
"authors": [ "Todd" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"compile": [ "../PackageTester.Shared/**/*.cs" ],
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"PackageTester.NETCore": "PackageTester.NETCore"
},
"frameworks": {
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Console": "4.0.0-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"Flurl.Http": "0.10.0",
"System.Linq": "4.0.0",
"System.Threading": "4.0.10"
}
}
"buildOptions": {
"emitEntryPoint": true,
"compile": {
"include": [ "../PackageTester.Shared/**/*.cs" ]
}
},
"dependencies": {
"Flurl.Http": "1.0.0"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0A32978C-BC48-4DFB-B1F7-B88541B0D686}</ProjectGuid>
@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
@ -39,31 +39,34 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="PclTester.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="Flurl, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.0.0\lib\portable-net40+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Flurl.dll</HintPath>
<Reference Include="Flurl, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.2.1.0\lib\portable40-net40+win8+wpa81\Flurl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Flurl.Http, Version=0.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.0.10.0\lib\portable-net45+win+wpa81+wp80\Flurl.Http.dll</HintPath>
<Reference Include="Flurl.Http, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Flurl.Http.1.0.0\lib\portable45-net45+win8+wpa81\Flurl.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wp8+wpa81\Microsoft.Threading.Tasks.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wp8+wpa81\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
@ -74,16 +77,12 @@
<HintPath>..\..\packages\PCLStorage.1.0.2\lib\portable-net45+wp8+wpa81+win8+monoandroid+monotouch+Xamarin.iOS+Xamarin.Mac\PCLStorage.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net45+win8+wpa81\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net45+win8+wpa81\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PackageTester
namespace PackageTester.PCL
{
public class PclTester : Tester { }
}
}

View File

@ -1,23 +0,0 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PackageTester.PCL")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,23 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="PCLStorage.Abstractions" publicKeyToken="286fe515a2c35b64" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.2.0" newVersion="1.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="PCLStorage" publicKeyToken="286fe515a2c35b64" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.2.0" newVersion="1.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Debug" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="PCLStorage.Abstractions" publicKeyToken="286fe515a2c35b64" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.0.2.0" newVersion="1.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="PCLStorage" publicKeyToken="286fe515a2c35b64" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.0.2.0" newVersion="1.0.2.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Flurl" version="2.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Flurl.Http" version="0.10.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="PCLStorage" version="1.0.2" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Flurl" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
<package id="Flurl.Http" version="1.0.0" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable45-net45+win8+wpa81" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wpa81" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="PCLStorage" version="1.0.2" targetFramework="portable45-net45+win8+wpa81" />
</packages>

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Flurl.Http;
using Flurl.Http.Testing;
@ -19,9 +17,9 @@ namespace PackageTester
log("^-- fake response");
}
var path = await "http://www.google.com".DownloadFileAsync("c:\\flurl", "google.txt");
var path = await "http://www.google.com".DownloadFileAsync("c:\\", "google.txt");
log("dowloaded google source to " + path);
log("done");
}
}
}
}

View File

@ -1,5 +1,11 @@
#Flurl
[![Build
status](https://ci.appveyor.com/api/projects/status/hec8ioqg0j07ttg5?svg=true)](https://ci.appveyor.com/project/kroniak/flurl)
[![NuGet](https://img.shields.io/nuget/v/Flurl.Http.svg?maxAge=86400)](https://www.nuget.org/packages/Flurl.Http/)
[![MyGet Pre
Release](https://img.shields.io/myget/flurl/vpre/Flurl.Http.svg?maxAge=86400)](https://www.myget.org/feed/flurl/package/nuget/Flurl.Http)
Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library.
````c#

View File

@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@ -27,42 +27,37 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</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" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Flurl.Http.NET45\Flurl.Http.NET45.csproj">
<Project>{e7001e27-e952-4e1a-a391-b14adae2a1a9}</Project>
<Name>Flurl.Http.NET45</Name>
</ProjectReference>
<ProjectReference Include="..\..\Flurl\Flurl.csproj">
<Project>{70a34167-759e-4902-82e0-e6a84c2ce46f}</Project>
<Name>Flurl</Name>
</ProjectReference>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="..\Test\Flurl.Test.Shared\Flurl.Test.Shared.projitems" Label="Shared" Condition="Exists('..\Test\Flurl.Test.Shared\Flurl.Test.Shared.projitems')" />
<Import Project="..\Flurl.Test.Shared\Flurl.Test.Shared.projitems" Label="Shared" Condition="Exists('..\Flurl.Test.Shared\Flurl.Test.Shared.projitems')" />
<Import Project="..\..\src\Flurl.Http.Shared\Flurl.Http.Shared.projitems" Label="Shared" />
<Import Project="..\..\src\Flurl.Shared\Flurl.Shared.projitems" Label="Shared" />
<Import Project="..\Flurl.Test.Shared\Flurl.Test.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>

View File

@ -1,30 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Flurl.Test.NET45")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5cb4c099-89c5-4773-bfa8-4273fff96f5a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="NUnit" version="3.4.1" targetFramework="net45" />
</packages>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>57899b31-5054-411e-b89b-ac949ea244ac</ProjectGuid>
<RootNamespace>Flurl.Test</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -0,0 +1,7 @@
namespace Flurl.Test
{
public class Program
{
public static int Main(string[] args) => 0;
}
}

View File

@ -0,0 +1,37 @@
{
"name": "Flurl.Test.NETCore",
"buildOptions": {
"compile": {
"include": [ "../Flurl.Test.Shared/**/*.cs" ]
}
},
"commands": {
"test": "Flurl.Test.NETCore"
},
"dependencies": {
"dotnet-test-nunit": "3.4.0-beta-1",
"Flurl.Http.Library": { "target": "project" },
"NUnit": "3.4.1"
},
"testRunner": "nunit",
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dnxcore50",
"netcoreapp1.0",
"portable-net45+win8"
],
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
}

View File

@ -13,13 +13,15 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@ -27,17 +29,21 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;PORTABLE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PCLStorage, Version=1.0.2.0, Culture=neutral, PublicKeyToken=286fe515a2c35b64, processorArchitecture=MSIL">
@ -52,31 +58,28 @@
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<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="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Flurl.Http.PCL\Flurl.Http.PCL.csproj">
<Project>{4c163dd1-318a-42c0-acf2-9e0d766d8900}</Project>
<Name>Flurl.Http.PCL</Name>
</ProjectReference>
<ProjectReference Include="..\..\Flurl\Flurl.csproj">
<Project>{70a34167-759e-4902-82e0-e6a84c2ce46f}</Project>
<Name>Flurl</Name>
</ProjectReference>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="..\Flurl.Test.Shared\Flurl.Test.Shared.projitems" Label="Shared" Condition="Exists('..\Flurl.Test.Shared\Flurl.Test.Shared.projitems')" />
<Import Project="..\..\src\Flurl.Shared\Flurl.Shared.projitems" Label="Shared" />
<Import Project="..\..\src\Flurl.Http.Shared\Flurl.Http.Shared.projitems" Label="Shared" />
<Import Project="..\Flurl.Test.Shared\Flurl.Test.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,30 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Flurl.Test.PCL")]
[assembly: AssemblyCopyright("Copyright © Todd Menier 2016")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("04006d5a-2391-4bda-9710-2bb1d75573f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="NUnit" version="3.4.1" targetFramework="net45" />
<package id="PCLStorage" version="1.0.2" targetFramework="net45" />
<package id="System.Linq" version="4.1.0" targetFramework="net45" />
</packages>

View File

@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Flurl.Util;
namespace Flurl.Test
{
[TestFixture]
public class CommonExtensionsTests
{
public class CommonExtensionsTests
{
[Test]
public void can_parse_object_to_kv() {
public void can_parse_object_to_kv()
{
var kv = new { one = 1, two = 2, three = "foo" }.ToKeyValuePairs();
CollectionAssert.AreEquivalent(new Dictionary<string, object> {
{ "one", 1 },
@ -21,7 +21,8 @@ namespace Flurl.Test
}
[Test]
public void can_parse_dictionary_to_kv() {
public void can_parse_dictionary_to_kv()
{
var kv = new Dictionary<string, object> {
{ "one", 1 },
{ "two", 2 },
@ -36,7 +37,8 @@ namespace Flurl.Test
}
[Test]
public void can_parse_collection_of_kvp_to_kv() {
public void can_parse_collection_of_kvp_to_kv()
{
var kv = new[] {
new KeyValuePair<object, object>("one", 1),
new KeyValuePair<object, object>("two", 2),
@ -51,7 +53,8 @@ namespace Flurl.Test
}
[Test]
public void can_parse_collection_of_conventional_objects_to_kv() {
public void can_parse_collection_of_conventional_objects_to_kv()
{
// convention is to accept collection of any arbitrary type that contains
// a property called Key or Name and a property called Value
var kv = new object[] {
@ -71,7 +74,8 @@ namespace Flurl.Test
}
[Test]
public void can_parse_string_to_kv() {
public void can_parse_string_to_kv()
{
var kv = "one=1&two=2&three=foo".ToKeyValuePairs();
CollectionAssert.AreEquivalent(new Dictionary<string, object> {
@ -81,18 +85,21 @@ namespace Flurl.Test
}, kv);
}
[Test, ExpectedException(typeof(ArgumentNullException))]
public void cannot_parse_null_to_kv() {
[Test]
public void cannot_parse_null_to_kv()
{
object obj = null;
var kv = obj.ToKeyValuePairs();
Assert.Throws<ArgumentNullException>(() => obj.ToKeyValuePairs());
}
[Test, ExpectedException(typeof(ArgumentException))]
public void cannot_parse_unknown_collection_to_kv() {
[Test]
public void cannot_parse_unknown_collection_to_kv()
{
var kv = new object[] {
new { Key = "one", Value = 1 },
new { Foo = "two", value = 2 }
}.ToKeyValuePairs().ToList(); // need to force it to iterate for the exception to be thrown
};
Assert.Throws<ArgumentException>(() => kv.ToKeyValuePairs().ToList());// need to force it to iterate for the exception to be thrown
}
}
}

View File

@ -13,6 +13,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Http\ClientConfigTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\ClientLifetimeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\HttpStatusRangeParserTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\MultipartTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\RealHttpTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\FlurlClientTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\GetTests.cs" />
@ -21,6 +22,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Http\HttpTestFixtureBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\PostTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Http\TestingTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PackageTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ReflectionHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UrlBuilderTests.cs" />
</ItemGroup>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>4c7c0861-84f6-436e-8fa6-4c318b336a7b</ProjectGuid>
@ -7,6 +7,9 @@
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="Flurl.Test.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
</Project>

View File

@ -10,190 +10,213 @@ using NUnit.Framework;
namespace Flurl.Test.Http
{
[TestFixture]
public class ClientConfigTestsBase : ConfigTestsBase
{
protected override FlurlHttpSettings GetSettings() {
return GetClient().Settings;
}
[TestFixture]
public class ClientConfigTestsBase : ConfigTestsBase
{
protected override FlurlHttpSettings GetSettings()
{
return GetClient().Settings;
}
[Test]
public void can_set_timeout() {
var client = "http://www.api.com".WithTimeout(TimeSpan.FromSeconds(15));
Assert.AreEqual(client.HttpClient.Timeout, TimeSpan.FromSeconds(15));
}
[Test]
public void can_set_timeout()
{
var client = "http://www.api.com".WithTimeout(TimeSpan.FromSeconds(15));
Assert.AreEqual(client.HttpClient.Timeout, TimeSpan.FromSeconds(15));
}
[Test]
public void can_set_timeout_in_seconds() {
var client = "http://www.api.com".WithTimeout(15);
Assert.AreEqual(client.HttpClient.Timeout, TimeSpan.FromSeconds(15));
}
[Test]
public void can_set_timeout_in_seconds()
{
var client = "http://www.api.com".WithTimeout(15);
Assert.AreEqual(client.HttpClient.Timeout, TimeSpan.FromSeconds(15));
}
[Test]
public void can_set_header() {
var client = "http://www.api.com".WithHeader("a", 1);
[Test]
public void can_set_header()
{
var client = "http://www.api.com".WithHeader("a", 1);
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(1, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "1" });
}
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(1, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "1" });
}
[Test]
public void can_set_headers_from_anon_object() {
var client = "http://www.api.com".WithHeaders(new { a = "b", one = 2 });
[Test]
public void can_set_headers_from_anon_object()
{
var client = "http://www.api.com".WithHeaders(new { a = "b", one = 2 });
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(2, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "b" });
Assert.AreEqual("one", headers[1].Key);
CollectionAssert.AreEqual(headers[1].Value, new[] { "2" });
}
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(2, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "b" });
Assert.AreEqual("one", headers[1].Key);
CollectionAssert.AreEqual(headers[1].Value, new[] { "2" });
}
[Test]
public void can_set_headers_from_dictionary() {
var client = "http://www.api.com".WithHeaders(new Dictionary<string, object> { { "a", "b" }, { "one", 2 } });
[Test]
public void can_set_headers_from_dictionary()
{
var client = "http://www.api.com".WithHeaders(new Dictionary<string, object> { { "a", "b" }, { "one", 2 } });
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(2, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "b" });
Assert.AreEqual("one", headers[1].Key);
CollectionAssert.AreEqual(headers[1].Value, new[] { "2" });
}
var headers = client.HttpClient.DefaultRequestHeaders.ToList();
Assert.AreEqual(2, headers.Count);
Assert.AreEqual("a", headers[0].Key);
CollectionAssert.AreEqual(headers[0].Value, new[] { "b" });
Assert.AreEqual("one", headers[1].Key);
CollectionAssert.AreEqual(headers[1].Value, new[] { "2" });
}
[Test]
public void can_setup_basic_auth() {
var client = "http://www.api.com".WithBasicAuth("user", "pass");
[Test]
public void can_setup_basic_auth()
{
var client = "http://www.api.com".WithBasicAuth("user", "pass");
var header = client.HttpClient.DefaultRequestHeaders.First();
Assert.AreEqual("Authorization", header.Key);
Assert.AreEqual("Basic dXNlcjpwYXNz", header.Value.First());
}
var header = client.HttpClient.DefaultRequestHeaders.First();
Assert.AreEqual("Authorization", header.Key);
Assert.AreEqual("Basic dXNlcjpwYXNz", header.Value.First());
}
[Test]
public void can_setup_oauth_bearer_token() {
var client = "http://www.api.com".WithOAuthBearerToken("mytoken");
[Test]
public void can_setup_oauth_bearer_token()
{
var client = "http://www.api.com".WithOAuthBearerToken("mytoken");
var header = client.HttpClient.DefaultRequestHeaders.First();
Assert.AreEqual("Authorization", header.Key);
Assert.AreEqual("Bearer mytoken", header.Value.First());
}
var header = client.HttpClient.DefaultRequestHeaders.First();
Assert.AreEqual("Authorization", header.Key);
Assert.AreEqual("Bearer mytoken", header.Value.First());
}
[Test]
public async Task can_allow_specific_http_status() {
using (var test = new HttpTest()) {
test.RespondWith(404, "Nothing to see here");
// no exception = pass
await "http://www.api.com"
.AllowHttpStatus(HttpStatusCode.Conflict, HttpStatusCode.NotFound)
.DeleteAsync();
}
}
[Test]
public async Task can_allow_specific_http_status()
{
using (var test = new HttpTest())
{
test.RespondWith("Nothing to see here", 404);
// no exception = pass
await "http://www.api.com"
.AllowHttpStatus(HttpStatusCode.Conflict, HttpStatusCode.NotFound)
.DeleteAsync();
}
}
[Test, ExpectedException(typeof(FlurlHttpException))]
public async Task can_clear_non_success_status() {
using (var test = new HttpTest()) {
test.RespondWith(418, "I'm a teapot");
// allow 4xx
var client = "http://www.api.com".AllowHttpStatus("4xx");
// but then disallow it
client.Settings.AllowedHttpStatusRange = null;
await client.GetAsync();
}
}
[Test]
public void can_clear_non_success_status()
{
using (var test = new HttpTest())
{
test.RespondWith("I'm a teapot", 418);
// allow 4xx
var client = "http://www.api.com".AllowHttpStatus("4xx");
// but then disallow it
client.Settings.AllowedHttpStatusRange = null;
Assert.ThrowsAsync<FlurlHttpException>(async () => await client.GetAsync());
}
}
[Test]
public async Task can_allow_any_http_status() {
using (var test = new HttpTest()) {
test.RespondWith(500, "epic fail");
try {
var result = await "http://www.api.com".AllowAnyHttpStatus().GetAsync();
Assert.IsFalse(result.IsSuccessStatusCode);
}
catch (Exception) {
Assert.Fail("Exception should not have been thrown.");
}
}
}
[Test]
public async Task can_allow_any_http_status()
{
using (var test = new HttpTest())
{
test.RespondWith("epic fail", 500);
try
{
var result = await "http://www.api.com".AllowAnyHttpStatus().GetAsync();
Assert.IsFalse(result.IsSuccessStatusCode);
}
catch (Exception)
{
Assert.Fail("Exception should not have been thrown.");
}
}
}
[Test, ExpectedException(typeof(FlurlHttpException))]
public async Task can_override_settings_fluently() {
using (var test = new HttpTest()) {
FlurlHttp.GlobalSettings.AllowedHttpStatusRange = "*";
test.RespondWith(500, "epic fail");
await "http://www.api.com".ConfigureClient(c => c.AllowedHttpStatusRange = "2xx").GetAsync();
}
}
[Test]
public void can_override_settings_fluently()
{
using (var test = new HttpTest())
{
FlurlHttp.GlobalSettings.AllowedHttpStatusRange = "*";
test.RespondWith("epic fail", 500);
Assert.ThrowsAsync<FlurlHttpException>(async () => await "http://www.api.com".ConfigureClient(c => c.AllowedHttpStatusRange = "2xx").GetAsync());
}
}
[Test]
public void WithUrl_shares_HttpClient_but_not_Url() {
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = client1.WithUrl("http://www.api.com/for-client2");
var client3 = client1.WithUrl("http://www.api.com/for-client3");
var client4 = client2.WithUrl("http://www.api.com/for-client4");
[Test]
public void WithUrl_shares_HttpClient_but_not_Url()
{
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = client1.WithUrl("http://www.api.com/for-client2");
var client3 = client1.WithUrl("http://www.api.com/for-client3");
var client4 = client2.WithUrl("http://www.api.com/for-client4");
CollectionAssert.AreEquivalent(client1.GetCookies(), client2.GetCookies());
CollectionAssert.AreEquivalent(client1.GetCookies(), client3.GetCookies());
CollectionAssert.AreEquivalent(client1.GetCookies(), client4.GetCookies());
var urls = new[] { client1, client2, client3, client4 }.Select(c => c.Url.ToString());
CollectionAssert.AllItemsAreUnique(urls);
}
CollectionAssert.AreEquivalent(client1.Cookies, client2.Cookies);
CollectionAssert.AreEquivalent(client1.Cookies, client3.Cookies);
CollectionAssert.AreEquivalent(client1.Cookies, client4.Cookies);
var urls = new[] { client1, client2, client3, client4 }.Select(c => c.Url.ToString());
CollectionAssert.AllItemsAreUnique(urls);
}
[Test]
public void WithUrl_doesnt_propagate_HttpClient_disposal() {
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = client1.WithUrl("http://www.api.com/for-client2");
var client3 = client1.WithUrl("http://www.api.com/for-client3");
var client4 = client2.WithUrl("http://www.api.com/for-client4");
[Test]
public void WithUrl_doesnt_propagate_HttpClient_disposal()
{
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = client1.WithUrl("http://www.api.com/for-client2");
var client3 = client1.WithUrl("http://www.api.com/for-client3");
var client4 = client2.WithUrl("http://www.api.com/for-client4");
client2.Dispose();
client3.Dispose();
client2.Dispose();
client3.Dispose();
CollectionAssert.IsEmpty(client2.GetCookies());
CollectionAssert.IsEmpty(client3.GetCookies());
CollectionAssert.IsEmpty(client2.Cookies);
CollectionAssert.IsEmpty(client3.Cookies);
CollectionAssert.IsNotEmpty(client1.GetCookies());
CollectionAssert.IsNotEmpty(client4.GetCookies());
}
CollectionAssert.IsNotEmpty(client1.Cookies);
CollectionAssert.IsNotEmpty(client4.Cookies);
}
[Test]
public void WithClient_shares_HttpClient_but_not_Url() {
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = "http://www.api.com/for-client2".WithClient(client1);
var client3 = "http://www.api.com/for-client3".WithClient(client1);
var client4 = "http://www.api.com/for-client4".WithClient(client1);
[Test]
public void WithClient_shares_HttpClient_but_not_Url()
{
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = "http://www.api.com/for-client2".WithClient(client1);
var client3 = "http://www.api.com/for-client3".WithClient(client1);
var client4 = "http://www.api.com/for-client4".WithClient(client1);
CollectionAssert.AreEquivalent(client1.GetCookies(), client2.GetCookies());
CollectionAssert.AreEquivalent(client1.GetCookies(), client3.GetCookies());
CollectionAssert.AreEquivalent(client1.GetCookies(), client4.GetCookies());
var urls = new[] { client1, client2, client3, client4 }.Select(c => c.Url.ToString());
CollectionAssert.AllItemsAreUnique(urls);
}
CollectionAssert.AreEquivalent(client1.Cookies, client2.Cookies);
CollectionAssert.AreEquivalent(client1.Cookies, client3.Cookies);
CollectionAssert.AreEquivalent(client1.Cookies, client4.Cookies);
var urls = new[] { client1, client2, client3, client4 }.Select(c => c.Url.ToString());
CollectionAssert.AllItemsAreUnique(urls);
}
[Test]
public void WithClient_doesnt_propagate_HttpClient_disposal() {
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = "http://www.api.com/for-client2".WithClient(client1);
var client3 = "http://www.api.com/for-client3".WithClient(client1);
var client4 = "http://www.api.com/for-client4".WithClient(client1);
[Test]
public void WithClient_doesnt_propagate_HttpClient_disposal()
{
var client1 = new FlurlClient("http://www.api.com/for-client1").WithCookie("mycookie", "123");
var client2 = "http://www.api.com/for-client2".WithClient(client1);
var client3 = "http://www.api.com/for-client3".WithClient(client1);
var client4 = "http://www.api.com/for-client4".WithClient(client1);
client2.Dispose();
client3.Dispose();
client2.Dispose();
client3.Dispose();
CollectionAssert.IsEmpty(client2.GetCookies());
CollectionAssert.IsEmpty(client3.GetCookies());
CollectionAssert.IsEmpty(client2.Cookies);
CollectionAssert.IsEmpty(client3.Cookies);
CollectionAssert.IsNotEmpty(client1.GetCookies());
CollectionAssert.IsNotEmpty(client4.GetCookies());
}
CollectionAssert.IsNotEmpty(client1.Cookies);
CollectionAssert.IsNotEmpty(client4.Cookies);
}
[Test]
public void can_use_uri_with_WithUrl() {
var uri = new System.Uri("http://www.mysite.com/foo?x=1");
var fc = new FlurlClient().WithUrl(uri);
Assert.AreEqual(uri.ToString(), fc.Url.ToString());
}
}
}
[Test]
public void can_use_uri_with_WithUrl()
{
var uri = new System.Uri("http://www.mysite.com/foo?x=1");
var fc = new FlurlClient().WithUrl(uri);
Assert.AreEqual(uri.ToString(), fc.Url.ToString());
}
}
}

View File

@ -1,4 +1,5 @@
using System.Linq;
using System.Reflection;
using Flurl.Http;
using NUnit.Framework;
@ -10,17 +11,17 @@ namespace Flurl.Test.Http
[Test]
// check that for every FlurlClient extension method, we have an equivalent Url and string extension
public void extension_methods_consistently_supported() {
var fcExts = ReflectionHelper.GetAllExtensionMethods<FlurlClient>(typeof(FlurlClient).Assembly);
var urlExts = ReflectionHelper.GetAllExtensionMethods<Url>(typeof(FlurlClient).Assembly);
var stringExts = ReflectionHelper.GetAllExtensionMethods<string>(typeof(FlurlClient).Assembly);
var whitelist = new[] { "GetCookies", "WithUrl" }; // cases where Url method of the same name was excluded intentionally
var fcExts = ReflectionHelper.GetAllExtensionMethods<FlurlClient>(typeof(FlurlClient).GetTypeInfo().Assembly);
var urlExts = ReflectionHelper.GetAllExtensionMethods<Url>(typeof(FlurlClient).GetTypeInfo().Assembly);
var stringExts = ReflectionHelper.GetAllExtensionMethods<string>(typeof(FlurlClient).GetTypeInfo().Assembly);
var whitelist = new[] { "WithUrl" }; // cases where Url method of the same name was excluded intentionally
foreach (var method in fcExts) {
if (whitelist.Contains(method.Name))
continue;
if (!urlExts.Any(m => ReflectionHelper.AreSameMethodSignatures(method, m))) {
Assert.Fail("No equivalent URL extension method found for FlurlClient.{0}", method.Name);
Assert.Fail("No equivalent Url extension method found for FlurlClient.{0}", method.Name);
}
if (!stringExts.Any(m => ReflectionHelper.AreSameMethodSignatures(method, m))) {
Assert.Fail("No equivalent string extension method found for FlurlClient.{0}", method.Name);
@ -28,4 +29,4 @@ namespace Flurl.Test.Http
}
}
}
}
}

View File

@ -85,7 +85,7 @@ namespace Flurl.Test.Http
[Test]
public async Task failure_throws_detailed_exception() {
HttpTest.RespondWith(500, "bad job");
HttpTest.RespondWith("bad job", status: 500);
try {
await "http://api.com".GetStringAsync();
@ -101,7 +101,7 @@ namespace Flurl.Test.Http
[Test]
public async Task can_get_error_json_typed() {
HttpTest.RespondWithJson(500, new { code = 999, message = "our server crashed" });
HttpTest.RespondWithJson(new { code = 999, message = "our server crashed" }, 500);
try {
await "http://api.com".GetStringAsync();
@ -116,7 +116,7 @@ namespace Flurl.Test.Http
[Test]
public async Task can_get_error_json_untyped() {
HttpTest.RespondWithJson(500, new { code = 999, message = "our server crashed" });
HttpTest.RespondWithJson(new { code = 999, message = "our server crashed" }, 500);
try {
await "http://api.com".GetStringAsync();

View File

@ -1,5 +1,4 @@
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Flurl.Http;
@ -41,7 +40,7 @@ namespace Flurl.Test.Http
public async Task can_allow_non_success_status() {
using (var test = new HttpTest()) {
GetSettings().AllowedHttpStatusRange = "4xx";
test.RespondWith(418, "I'm a teapot");
test.RespondWith("I'm a teapot", 418);
try {
var result = await GetClient().GetAsync();
Assert.IsFalse(result.IsSuccessStatusCode);
@ -87,7 +86,7 @@ namespace Flurl.Test.Http
public async Task can_set_error_callback(bool markExceptionHandled) {
var callbackCalled = false;
using (var test = new HttpTest()) {
test.RespondWith(500, "server error");
test.RespondWith("server error", 500);
GetSettings().OnError = call => {
CollectionAssert.IsEmpty(test.ResponseQueue); // verifies that callback is running after HTTP call is made
callbackCalled = true;
@ -112,7 +111,7 @@ namespace Flurl.Test.Http
GetSettings().OnError = call => {
call.ExceptionHandled = true;
};
test.RespondWith(500, "server error");
test.RespondWith("server error", 500);
try {
var result = await GetClient().GetAsync();
Assert.IsFalse(result.IsSuccessStatusCode);

View File

@ -49,11 +49,11 @@ namespace Flurl.Test.Http
return HttpStatusRangeParser.IsMatch(pattern, value);
}
[TestCase("-100", ExpectedException = typeof(ArgumentException))]
[TestCase("100-", ExpectedException = typeof(ArgumentException))]
[TestCase("1yy", ExpectedException = typeof(ArgumentException))]
[TestCase("-100")]
[TestCase("100-")]
[TestCase("1yy")]
public void parser_throws_on_invalid_pattern(string pattern) {
var x = HttpStatusRangeParser.IsMatch(pattern, 100);
Assert.Throws<ArgumentException>(() => HttpStatusRangeParser.IsMatch(pattern, 100));
}
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Flurl.Http;
using Flurl.Http.Content;
using NUnit.Framework;
namespace Flurl.Test.Http
{
[TestFixture]
public class MultipartTests
{
[Test]
public void can_build_multipart_content() {
var content = new CapturedMultipartContent()
.AddString("string", "foo")
.AddStringParts(new { part1 = 1, part2 = 2, part3 = (string)null }) // part3 should be excluded
.AddFile("file", @"path\to\image.jpg", "image/jpeg")
.AddJson("json", new { foo = "bar" })
.AddUrlEncoded("urlEnc", new { fizz = "buzz" });
Assert.AreEqual(6, content.Parts.Length);
Assert.AreEqual("string", content.Parts[0].Headers.ContentDisposition.Name);
Assert.IsInstanceOf<CapturedStringContent>(content.Parts[0]);
Assert.AreEqual("foo", (content.Parts[0] as CapturedStringContent).Content);
Assert.AreEqual("part1", content.Parts[1].Headers.ContentDisposition.Name);
Assert.IsInstanceOf<CapturedStringContent>(content.Parts[1]);
Assert.AreEqual("1", (content.Parts[1] as CapturedStringContent).Content);
Assert.AreEqual("part2", content.Parts[2].Headers.ContentDisposition.Name);
Assert.IsInstanceOf<CapturedStringContent>(content.Parts[2]);
Assert.AreEqual("2", (content.Parts[2] as CapturedStringContent).Content);
Assert.AreEqual("file", content.Parts[3].Headers.ContentDisposition.Name);
Assert.AreEqual("image.jpg", content.Parts[3].Headers.ContentDisposition.FileName);
Assert.IsInstanceOf<FileContent>(content.Parts[3]);
Assert.AreEqual("json", content.Parts[4].Headers.ContentDisposition.Name);
Assert.IsInstanceOf<CapturedJsonContent>(content.Parts[4]);
Assert.AreEqual("{\"foo\":\"bar\"}", (content.Parts[4] as CapturedJsonContent).Content);
Assert.AreEqual("urlEnc", content.Parts[5].Headers.ContentDisposition.Name);
Assert.IsInstanceOf<CapturedUrlEncodedContent>(content.Parts[5]);
Assert.AreEqual("fizz=buzz", (content.Parts[5] as CapturedUrlEncodedContent).Content);
}
[Test]
public void must_provide_required_args_to_builder() {
var content = new CapturedMultipartContent();
Assert.Throws<ArgumentNullException>(() => content.AddStringParts(null));
Assert.Throws<ArgumentNullException>(() => content.AddString("other", null));
Assert.Throws<ArgumentException>(() => content.AddString(null, "hello!"));
Assert.Throws<ArgumentException>(() => content.AddFile(" ", "path"));
}
}
}

View File

@ -1,8 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Flurl.Http;
@ -20,15 +18,16 @@ namespace Flurl.Test.Http
{
[Test]
public async Task can_download_file() {
var path = await "http://www.google.com".DownloadFileAsync(@"c:\a\b", "google.txt");
Assert.AreEqual(@"c:\a\b\google.txt", path);
var folder = "c:\\flurl-test-" + Guid.NewGuid(); // random so parallel tests don't trip over each other
var path = await "http://www.google.com".DownloadFileAsync(folder, "google.txt");
Assert.AreEqual($@"{folder}\google.txt", path);
Assert.That(File.Exists(path));
File.Delete(path);
Directory.Delete(@"c:\a", true);
Directory.Delete(folder, true);
}
[Test]
public async Task can_set_cookies() {
public async Task can_set_request_cookies() {
var resp = await "http://httpbin.org/cookies".WithCookies(new { x = 1, y = 2 }).GetJsonAsync();
// httpbin returns json representation of cookies that were set on the server.
@ -36,15 +35,29 @@ namespace Flurl.Test.Http
Assert.AreEqual("2", resp.cookies.y);
}
[Test]
public async Task can_set_cookies_before_setting_url() {
var fc = new FlurlClient().WithCookie("z", "999");
var resp = await fc.WithUrl("http://httpbin.org/cookies").GetJsonAsync();
Assert.AreEqual("999", resp.cookies.z);
}
[Test]
public async Task can_get_response_cookies() {
var fc = new FlurlClient().EnableCookies();
await fc.WithUrl("https://httpbin.org/cookies/set?z=999").HeadAsync();
Assert.AreEqual("999", fc.Cookies["z"].Value);
}
[Test]
public async Task cant_persist_cookies_without_resuing_client() {
var fc = "http://httpbin.org/cookies".WithCookie("z", 999);
// cookie should be set
Assert.AreEqual("999", fc.GetCookies()["z"].Value);
Assert.AreEqual("999", fc.Cookies["z"].Value);
await fc.HeadAsync();
// FlurlClient was auto-disposed, so cookie should be gone
Assert.IsFalse(fc.GetCookies().ContainsKey("z"));
CollectionAssert.IsEmpty(fc.Cookies);
// httpbin returns json representation of cookies that were set on the server.
var resp = await "http://httpbin.org/cookies".GetJsonAsync();
@ -56,13 +69,13 @@ namespace Flurl.Test.Http
using (var fc = new FlurlClient()) {
var fc2 = "http://httpbin.org/cookies".WithClient(fc).WithCookie("z", 999);
// cookie should be set
Assert.AreEqual("999", fc.GetCookies()["z"].Value);
Assert.AreEqual("999", fc2.GetCookies()["z"].Value);
Assert.AreEqual("999", fc.Cookies["z"].Value);
Assert.AreEqual("999", fc2.Cookies["z"].Value);
await fc2.HeadAsync();
// FlurlClient should be re-used, so cookie should stick
Assert.AreEqual("999", fc.GetCookies()["z"].Value);
Assert.AreEqual("999", fc2.GetCookies()["z"].Value);
Assert.AreEqual("999", fc.Cookies["z"].Value);
Assert.AreEqual("999", fc2.Cookies["z"].Value);
// httpbin returns json representation of cookies that were set on the server.
var resp = await "http://httpbin.org/cookies".WithClient(fc).GetJsonAsync();
@ -98,9 +111,9 @@ namespace Flurl.Test.Http
Assert.Greater(bytes.Length, 0);
}
[Test, ExpectedException(typeof(FlurlHttpException))]
public async Task fails_on_non_success_status() {
await "http://httpbin.org/status/418".GetAsync();
[Test]
public void fails_on_non_success_status() {
Assert.ThrowsAsync<FlurlHttpException>(async () => await "http://httpbin.org/status/418".GetAsync());
}
[Test]
@ -109,17 +122,68 @@ namespace Flurl.Test.Http
}
[Test]
public async Task can_cancel_request() {
try {
public void can_cancel_request() {
var ex = Assert.ThrowsAsync<FlurlHttpException>(async () =>
{
var cts = new CancellationTokenSource();
var task = "http://www.google.com".GetStringAsync(cts.Token);
cts.Cancel();
await task;
Assert.Fail("Should have thrown exception on cancelation");
});
Assert.IsNotNull(ex.InnerException as TaskCanceledException);
}
[Test]
public async Task can_post_multipart() {
var folder = "c:\\flurl-test-" + Guid.NewGuid(); // random so parallel tests don't trip over each other
Directory.CreateDirectory(folder);
var path1 = Path.Combine(folder, "upload1.txt");
var path2 = Path.Combine(folder, "upload2.txt");
File.WriteAllText(path1, "file contents 1");
File.WriteAllText(path2, "file contents 2");
try {
using (var stream = File.OpenRead(path2)) {
var resp = await "http://httpbin.org/post"
.PostMultipartAsync(content => content
.AddStringParts(new {a = 1, b = 2})
.AddString("DataField", "hello!")
.AddFile("File1", path1)
.AddFile("File2", stream, "foo.txt"))
//.ReceiveString();
.ReceiveJson();
Assert.AreEqual("1", resp.form.a);
Assert.AreEqual("2", resp.form.b);
Assert.AreEqual("hello!", resp.form.DataField);
Assert.AreEqual("file contents 1", resp.files.File1);
Assert.AreEqual("file contents 2", resp.files.File2);
}
}
catch (FlurlHttpException ex) {
Assert.IsNotNull(ex.InnerException as TaskCanceledException);
finally {
Directory.Delete(folder, true);
}
}
// https://github.com/tmenier/Flurl/pull/76
// quotes around charset value is technically legal but there's a bug in .NET we want to avoid: https://github.com/dotnet/corefx/issues/5014
[Test]
public async Task supports_quoted_charset() {
// Respond with header Content-Type: text/javascript; charset="UTF-8"
var url = "https://httpbin.org/response-headers?Content-Type=text/javascript;%20charset=%22UTF-8%22";
// confirm thart repsonse has quoted charset value
var resp = await url.GetAsync();
Assert.AreEqual("\"UTF-8\"", resp.Content.Headers.ContentType.CharSet);
// GetStringAsync is where we need to work around the .NET bug
var s = await url.GetStringAsync();
// not throwing should be enough, but do a little more for good measure..
s = s.Trim();
StringAssert.StartsWith("{", s);
StringAssert.EndsWith("}", s);
}
}
}
}

View File

@ -75,5 +75,25 @@ namespace Flurl.Test.Http
StringAssert.Contains("timed out", ex.Message);
}
}
[Test]
public async Task can_fake_headers() {
HttpTest.RespondWith(headers: new { h1 = "foo" });
var resp = await "http://www.api.com".GetAsync();
Assert.AreEqual(1, resp.Headers.Count());
Assert.AreEqual("h1", resp.Headers.First().Key);
Assert.AreEqual("foo", resp.Headers.First().Value.First());
}
[Test]
public async Task can_fake_cookies() {
HttpTest.RespondWith(cookies: new { c1 = "foo" });
var fc = "http://www.api.com".EnableCookies();
await fc.GetAsync();
Assert.AreEqual(1, fc.Cookies.Count());
Assert.AreEqual("foo", fc.Cookies["c1"].Value);
}
}
}

View File

@ -0,0 +1,51 @@
#if !PORTABLE
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Newtonsoft.Json;
using NUnit.Framework;
#if NETCOREAPP1_0
using NUnit.Framework.Internal;
#endif
namespace Flurl.Test
{
[TestFixture]
public class PackageTests
{
[Test]
public void flurl_versions_are_consistent() {
var projVer = GetProjectVersion(@"src\Flurl.Library\project.json");
var nuspecVer = GetNuspecVersion(@"build\nuspec\Flurl.nuspec");
Assert.AreEqual(projVer, nuspecVer);
}
[Test]
public void flurlhttp_versions_are_consistent() {
var projVer = GetProjectVersion(@"src\Flurl.Http.Library\project.json");
var nuspecVer = GetNuspecVersion(@"build\nuspec\Flurl.Http.nuspec");
Assert.AreEqual(projVer, nuspecVer);
}
private string GetNuspecVersion(string pathFromSolutionRoot) {
var path = GetFullPath(pathFromSolutionRoot);
return XDocument.Load(path).Descendants("version").FirstOrDefault()?.Value;
}
private string GetProjectVersion(string pathFromSolutionRoot) {
var path = GetFullPath(pathFromSolutionRoot);
dynamic d = JsonConvert.DeserializeObject<ExpandoObject>(File.ReadAllText(path));
return d.version;
}
private string GetFullPath(string pathFromSolutionRoot) {
#if NET45
return Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\..\..", pathFromSolutionRoot);
#elif NETCOREAPP1_0
return Path.Combine(AssemblyHelper.GetAssemblyPath(GetType()), @"..\..\..\..\..\..\", pathFromSolutionRoot);
#endif
}
}
}
#endif

View File

@ -11,7 +11,7 @@ namespace Flurl.Test
// http://stackoverflow.com/a/299526/62600
return (
from type in asm.GetTypes()
where type.IsSealed && !type.IsGenericType && !type.IsNested
where type.GetTypeInfo().IsSealed && !type.GetTypeInfo().IsGenericType && !type.GetTypeInfo().IsNested
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
where method.IsDefined(typeof(ExtensionAttribute), false)
where method.GetParameters()[0].ParameterType == typeof(T)
@ -55,9 +55,9 @@ namespace Flurl.Test
public static bool IsExtensionMethod(MethodInfo method) {
var type = method.DeclaringType;
return
type.IsSealed &&
!type.IsGenericType &&
!type.IsNested &&
type.GetTypeInfo().IsSealed &&
!type.GetTypeInfo().IsGenericType &&
!type.GetTypeInfo().IsNested &&
method.IsStatic &&
method.IsDefined(typeof(ExtensionAttribute), false);
}
@ -73,8 +73,9 @@ namespace Flurl.Test
public static bool AreSameType(Type a, Type b) {
if (a.IsGenericParameter && b.IsGenericParameter) {
var constraintsA = a.GetGenericParameterConstraints();
var constraintsB = b.GetGenericParameterConstraints();
var constraintsA = a.GetTypeInfo().GetGenericParameterConstraints();
var constraintsB = b.GetTypeInfo().GetGenericParameterConstraints();
if (constraintsA.Length != constraintsB.Length)
return false;
@ -86,7 +87,8 @@ namespace Flurl.Test
return true;
}
if (a.IsGenericType && b.IsGenericType) {
if (a.GetTypeInfo().IsGenericType && b.GetTypeInfo().IsGenericType) {
if (a.GetGenericTypeDefinition() != b.GetGenericTypeDefinition())
return false;
@ -107,4 +109,4 @@ namespace Flurl.Test
return a == b;
}
}
}
}

View File

@ -10,33 +10,38 @@ using NUnit.Framework;
namespace Flurl.Test
{
[TestFixture]
public class UrlBuilderTests
{
public class UrlBuilderTests
{
[Test]
// check that for every Url method, we have an equivalent string extension
public void extension_methods_consistently_supported() {
public void extension_methods_consistently_supported()
{
var urlMethods = typeof(Url).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).Where(m => !m.IsSpecialName);
var stringExts = ReflectionHelper.GetAllExtensionMethods<string>(typeof(Url).Assembly);
var stringExts = ReflectionHelper.GetAllExtensionMethods<string>(typeof(Url).GetTypeInfo().Assembly);
var whitelist = new[] { "ToString", "IsValid" }; // cases where string extension of the same name was excluded intentionally
foreach (var method in urlMethods) {
foreach (var method in urlMethods)
{
if (whitelist.Contains(method.Name))
continue;
if (!stringExts.Any(m => ReflectionHelper.AreSameMethodSignatures(method, m))) {
if (!stringExts.Any(m => ReflectionHelper.AreSameMethodSignatures(method, m)))
{
Assert.Fail("No equivalent string extension method found for Url.{0}", method.Name);
}
}
}
[Test]
public void Path_returns_everything_but_querystring() {
public void Path_returns_everything_but_querystring()
{
var path = new Url("http://www.mysite.com/more?x=1&y=2").Path;
Assert.AreEqual("http://www.mysite.com/more", path);
}
[Test]
public void query_params_parse_correctly() {
public void query_params_parse_correctly()
{
// y has 2 values, which should be grouped into an array
var q = new Url("http://www.mysite.com/more?x=1&y=2&z=3&y=4").QueryParams;
Assert.AreEqual("1", q["x"]);
@ -45,13 +50,15 @@ namespace Flurl.Test
}
[Test]
public void can_get_query_param_array() {
public void can_get_query_param_array()
{
var url = new Url("http://www.mysite.com/more?x=1&y=2&x=3&z=4&x=5");
CollectionAssert.AreEqual(new[] { "1", "3", "5" }, url.QueryParams["x"] as object[]);
}
[Test]
public void can_set_query_param_array() {
public void can_set_query_param_array()
{
var url = new Url("http://www.mysite.com/more?x=1&y=2&x=2&z=4");
// go from 2 values to 3, order should be preserved
url.QueryParams["x"] = new[] { 8, 9, 10 };
@ -65,25 +72,29 @@ namespace Flurl.Test
}
[Test]
public void can_sort_query_params() {
public void can_sort_query_params()
{
var url = new Url("http://www.mysite.com/more?z=1&y=2&x=3");
url.QueryParams.Sort((x, y) => x.Name.CompareTo(y.Name));
Assert.AreEqual("http://www.mysite.com/more?x=3&y=2&z=1", url.ToString());
}
[Test, ExpectedException(typeof(ArgumentNullException))]
public void constructor_requires_nonnull_arg() {
new Url(null);
[Test]
public void constructor_requires_nonnull_arg()
{
Assert.Throws<ArgumentNullException>(() => new Url(null));
}
[Test]
public void Combine_works() {
public void Combine_works()
{
var url = Url.Combine("http://www.foo.com/", "/too/", "/many/", "/slashes/", "too", "few", "one/two/");
Assert.AreEqual("http://www.foo.com/too/many/slashes/too/few/one/two/", url);
}
[Test]
public void GetRoot_works() {
public void GetRoot_works()
{
// simple case
var root = Url.GetRoot("http://mysite.com/one/two/three");
Assert.AreEqual("http://mysite.com", root);
@ -94,37 +105,43 @@ namespace Flurl.Test
}
[Test]
public void can_append_path_segment() {
public void can_append_path_segment()
{
var url = "http://www.mysite.com".AppendPathSegment("endpoint");
Assert.AreEqual("http://www.mysite.com/endpoint", url.ToString());
}
[Test, ExpectedException(typeof(ArgumentNullException))]
public void appending_null_path_segment_throws_arg_null_ex() {
"http://www.mysite.com".AppendPathSegment(null);
[Test]
public void appending_null_path_segment_throws_arg_null_ex()
{
Assert.Throws<ArgumentNullException>(() => "http://www.mysite.com".AppendPathSegment(null));
}
[Test]
public void can_append_multiple_path_segments_by_multi_args() {
public void can_append_multiple_path_segments_by_multi_args()
{
var url = "http://www.mysite.com".AppendPathSegments("category", "/endpoint/");
Assert.AreEqual("http://www.mysite.com/category/endpoint/", url.ToString());
}
[Test]
public void can_append_multiple_path_segments_by_enumerable() {
public void can_append_multiple_path_segments_by_enumerable()
{
IEnumerable<string> segments = new[] { "/category/", "endpoint" };
var url = "http://www.mysite.com".AppendPathSegments(segments);
Assert.AreEqual("http://www.mysite.com/category/endpoint", url.ToString());
}
[Test]
public void can_add_query_param() {
public void can_add_query_param()
{
var url = "http://www.mysite.com".SetQueryParam("x", 1);
Assert.AreEqual("http://www.mysite.com?x=1", url.ToString());
}
[Test]
public void can_add_query_param_without_value() {
public void can_add_query_param_without_value()
{
var url = new Url("http://example.com?123456");
Assert.AreEqual("http://example.com", url.Path);
Assert.AreEqual(1, url.QueryParams.Count);
@ -132,26 +149,31 @@ namespace Flurl.Test
}
[Test]
public void can_change_query_param() {
public void can_change_query_param()
{
var url = "http://www.mysite.com?x=1".SetQueryParam("x", 2);
Assert.AreEqual("http://www.mysite.com?x=2", url.ToString());
}
[Test]
public void null_query_param_is_excluded() {
public void null_query_param_is_excluded()
{
var url = "http://www.mysite.com".SetQueryParam("x", null);
Assert.AreEqual("http://www.mysite.com", url.ToString());
}
[Test]
public void enumerable_query_param_is_split_into_multiple() {
public void enumerable_query_param_is_split_into_multiple()
{
var url = "http://www.mysite.com".SetQueryParam("x", new[] { "a", "b", null, "c" });
Assert.AreEqual("http://www.mysite.com?x=a&x=b&x=c", url.ToString());
}
[Test]
public void can_add_multiple_query_params_from_anon_object() {
var url = "http://www.mysite.com".SetQueryParams(new {
public void can_add_multiple_query_params_from_anon_object()
{
var url = "http://www.mysite.com".SetQueryParams(new
{
x = 1,
y = 2,
z = new[] { 3, 4 },
@ -161,61 +183,73 @@ namespace Flurl.Test
}
[Test]
public void can_change_multiple_query_params_from_anon_object() {
var url = "http://www.mysite.com?x=1&y=2&z=3".SetQueryParams(new {
x = 8,
y = new[] {"a", "b"},
public void can_change_multiple_query_params_from_anon_object()
{
var url = "http://www.mysite.com?x=1&y=2&z=3".SetQueryParams(new
{
x = 8,
y = new[] { "a", "b" },
z = (int?)null
});
Assert.AreEqual("http://www.mysite.com?x=8&y=a&y=b", url.ToString());
}
[Test]
public void can_add_multiple_query_params_from_dictionary() {
public void can_add_multiple_query_params_from_dictionary()
{
// let's challenge it a little with non-string keys
var url = "http://www.mysite.com".SetQueryParams(new Dictionary<int, string> {{1, "x"}, {2, "y"}});
var url = "http://www.mysite.com".SetQueryParams(new Dictionary<int, string> { { 1, "x" }, { 2, "y" } });
Assert.AreEqual("http://www.mysite.com?1=x&2=y", url.ToString());
}
[Test]
public void can_remove_query_param() {
public void can_remove_query_param()
{
var url = "http://www.mysite.com/more?x=1&y=2".RemoveQueryParam("x");
Assert.AreEqual("http://www.mysite.com/more?y=2", url.ToString());
}
[Test]
public void can_remove_query_params_by_multi_args() {
public void can_remove_query_params_by_multi_args()
{
var url = "http://www.mysite.com/more?x=1&y=2".RemoveQueryParams("x", "y");
Assert.AreEqual("http://www.mysite.com/more", url.ToString());
}
[Test]
public void can_remove_query_params_by_enumerable() {
var url = "http://www.mysite.com/more?x=1&y=2&z=3".RemoveQueryParams(new[] {"x", "z"});
public void can_remove_query_params_by_enumerable()
{
var url = "http://www.mysite.com/more?x=1&y=2&z=3".RemoveQueryParams(new[] { "x", "z" });
Assert.AreEqual("http://www.mysite.com/more?y=2", url.ToString());
}
[Test]
public void removing_nonexisting_query_params_is_ignored() {
public void removing_nonexisting_query_params_is_ignored()
{
var url = "http://www.mysite.com/more".RemoveQueryParams("x", "y");
Assert.AreEqual("http://www.mysite.com/more", url.ToString());
}
#if !NETCOREAPP1_0
[Test]
public void url_ToString_uses_invariant_culture() {
public void url_ToString_uses_invariant_culture()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es-ES");
var url = "http://www.mysite.com".SetQueryParam("x", 1.1);
Assert.AreEqual("http://www.mysite.com?x=1.1", url.ToString());
}
#endif
[Test]
public void can_reset_to_root() {
public void can_reset_to_root()
{
var url = "http://www.mysite.com/more?x=1&y=2#foo".ResetToRoot();
Assert.AreEqual("http://www.mysite.com", url.ToString());
}
[Test]
public void can_do_crazy_long_fluent_expression() {
public void can_do_crazy_long_fluent_expression()
{
var url = "http://www.mysite.com"
.SetQueryParams(new { a = 1, b = 2, c = 999 })
.SetFragment("fooey")
@ -230,56 +264,65 @@ namespace Flurl.Test
}
[Test]
public void encodes_invalid_path_chars() {
public void encodes_invalid_path_chars()
{
var url = "http://www.mysite.com".AppendPathSegment("hey there how are ya");
Assert.AreEqual("http://www.mysite.com/hey%20there%20how%20are%20ya", url.ToString());
}
[Test]
public void does_not_reencode_path_escape_chars() {
public void does_not_reencode_path_escape_chars()
{
var url = "http://www.mysite.com".AppendPathSegment("hey%20there%20how%20are%20ya");
Assert.AreEqual("http://www.mysite.com/hey%20there%20how%20are%20ya", url.ToString());
}
[Test]
public void encodes_query_params() {
public void encodes_query_params()
{
var url = "http://www.mysite.com".SetQueryParams(new { x = "$50", y = "2+2=4" });
Assert.AreEqual("http://www.mysite.com?x=%2450&y=2%2B2%3D4", url.ToString());
}
[Test]
public void does_not_reencode_encoded_query_values() {
public void does_not_reencode_encoded_query_values()
{
var url = "http://www.mysite.com".SetQueryParam("x", "%CD%EE%E2%FB%E9%20%E3%EE%E4", true);
Assert.AreEqual("http://www.mysite.com?x=%CD%EE%E2%FB%E9%20%E3%EE%E4", url.ToString());
}
[Test]
public void reencodes_encoded_query_values_when_isEncoded_false() {
public void reencodes_encoded_query_values_when_isEncoded_false()
{
var url = "http://www.mysite.com".SetQueryParam("x", "%CD%EE%E2%FB%E9%20%E3%EE%E4", false);
Assert.AreEqual("http://www.mysite.com?x=%25CD%25EE%25E2%25FB%25E9%2520%25E3%25EE%25E4", url.ToString());
}
[Test]
public void Url_implicitly_converts_to_string() {
public void Url_implicitly_converts_to_string()
{
var url = new Url("http://www.mysite.com/more?x=1&y=2");
var someMethodThatTakesAString = new Action<string>(s => { });
someMethodThatTakesAString(url); // if this compiles, test passed.
}
[Test]
public void interprets_plus_as_space() {
public void interprets_plus_as_space()
{
var url = new Url("http://www.mysite.com/foo+bar?x=1+2");
Assert.AreEqual("1 2", url.QueryParams["x"]);
}
[Test]
public void can_encode_space_as_plus() {
public void can_encode_space_as_plus()
{
var url = new Url("http://www.mysite.com/foo+bar?x=1+2");
Assert.AreEqual("http://www.mysite.com/foo+bar?x=1+2", url.ToString(true));
}
[Test]
public void encodes_plus() {
public void encodes_plus()
{
var url = new Url("http://www.mysite.com").SetQueryParam("x", "1+2");
Assert.AreEqual("http://www.mysite.com?x=1%2B2", url.ToString());
}
@ -292,14 +335,16 @@ namespace Flurl.Test
[TestCase("blah", false)]
[TestCase("http:/www.mysite.com", false)]
[TestCase("www.mysite.com", false)]
public void IsUrl_works(string s, bool isValid) {
public void IsUrl_works(string s, bool isValid)
{
Assert.AreEqual(isValid, Url.IsValid(s));
Assert.AreEqual(isValid, new Url(s).IsValid());
}
// #56
[Test]
public void does_not_alter_url_passed_to_constructor() {
public void does_not_alter_url_passed_to_constructor()
{
var expected = "http://www.mysite.com/hi%20there/more?x=%CD%EE%E2%FB%E9%20%E3%EE%E4";
var url = new Url(expected);
Assert.AreEqual(expected, url.ToString());
@ -307,7 +352,8 @@ namespace Flurl.Test
// #29
[Test]
public void can_add_and_remove_fragment_fluently() {
public void can_add_and_remove_fragment_fluently()
{
var url = "http://www.mysite.com".SetFragment("foo");
Assert.AreEqual("http://www.mysite.com#foo", url.ToString());
url = "http://www.mysite.com#foo".RemoveFragment();
@ -323,7 +369,8 @@ namespace Flurl.Test
}
[Test]
public void has_fragment_after_SetQueryParam() {
public void has_fragment_after_SetQueryParam()
{
var expected = "http://www.mysite.com/more?x=1#first";
var url = new Url(expected)
.SetQueryParam("x", 3)
@ -335,7 +382,8 @@ namespace Flurl.Test
[TestCase("http://www.mysite.com/with/path?x=1#foo", "http://www.mysite.com/with/path", "x=1", "foo")]
[TestCase("http://www.mysite.com/with/path?x=1?y=2", "http://www.mysite.com/with/path", "x=1?y=2", "")]
[TestCase("http://www.mysite.com/#with/path?x=1?y=2", "http://www.mysite.com/", "", "with/path?x=1?y=2")]
public void constructor_parses_url_correctly(string full, string path, string query, string fragment) {
public void constructor_parses_url_correctly(string full, string path, string query, string fragment)
{
var url = new Url(full);
Assert.AreEqual(path, url.Path);
Assert.AreEqual(query, url.Query);

25
appveyor.yml Normal file
View File

@ -0,0 +1,25 @@
version: 1.0.0-{branch}-{build}
branches:
# whitelist
only:
- master
- dev
pull_requests:
do_not_increment_build_number: true
os: Visual Studio 2015
install:
- ps: .\build\scripts\install.ps1
build_script:
- ps: .\build\scripts\show-dotnet-info.ps1
- cmd: call cmd /C "cd .\build & pack.flurl.cmd & pack.flurl.http.cmd"
test_script:
- cmd: call cmd /C "cd .\build & test.cmd"
artifacts:
- path: '**\*.nupkg'

View File

@ -1,6 +1,6 @@
{
"projects": [ ".", "test" ],
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-rc1-update1"
"version": "1.0.0-preview2-003121"
}
}

View File

@ -0,0 +1,77 @@
using System;
using System.IO;
namespace Flurl.Http.CodeGen
{
/// <summary>
/// Wraps a StreamWriter. Mainly just keeps track of indentation.
/// </summary>
public class CodeWriter : IDisposable
{
private readonly StreamWriter _sw;
private int _indent;
private bool _wrapping;
public CodeWriter(string filePath)
{
_sw = new StreamWriter(File.OpenWrite(filePath));
}
/// <summary>
/// use @0, @1, @2, etc for tokens. ({0} would be a pain because you'd alway need to escape "{" and "}")
/// </summary>
public CodeWriter WriteLine(string line, params object[] args)
{
line = line.Trim();
for (int i = 0; i < args.Length; i++)
{
var val = (args[i] == null) ? "" : args[i].ToString();
line = line.Replace("@" + i, val);
}
if (line == "}" || line == "{")
{
_indent--;
}
_sw.Write(new String('\t', _indent));
_sw.WriteLine(line);
if (line == "" || line.StartsWith("//") || line.EndsWith("]"))
{
_wrapping = false;
}
else if (line.EndsWith(";") || line.EndsWith("}"))
{
if (_wrapping)
_indent--;
_wrapping = false;
}
else if (line.EndsWith("{"))
{
_indent++;
_wrapping = false;
}
else
{
if (!_wrapping)
_indent++;
_wrapping = true;
}
return this; // fluent!
}
public CodeWriter WriteLine()
{
_sw.WriteLine();
return this;
}
public void Dispose()
{
_sw.Dispose();
}
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Flurl.Http.CodeGen
{
@ -10,33 +7,34 @@ namespace Flurl.Http.CodeGen
{
public static IEnumerable<ExtensionMethodModel> GetAll() {
return
from httpVerb in new[] { "Get", "Post", "Head", "Put", "Delete", "Patch" }
from httpVerb in new[] { null, "Get", "Post", "Head", "Put", "Delete", "Patch" }
from bodyType in new[] { null, "Json", /*"Xml",*/ "String", "UrlEncoded" }
where AllowRequestBody(httpVerb) || bodyType == null
from extensionType in new[] { "FlurlClient", "Url", "string" }
where SupportedCombo(httpVerb, bodyType, extensionType)
from deserializeType in new[] { null, "Json", "JsonList", /*"Xml",*/ "String", "Stream", "Bytes" }
where httpVerb == "Get" || deserializeType == null
from isGeneric in new[] { true, false }
where AllowDeserializeToGeneric(deserializeType) || !isGeneric
from hasCancelationToken in new[] { true, false }
select new ExtensionMethodModel {
HttpVerb = httpVerb,
BodyType = bodyType,
ExtentionOfType = extensionType,
DeserializeToType = deserializeType,
HasCancelationToken = hasCancelationToken,
IsGeneric = isGeneric
};
}
private static bool AllowRequestBody(string verb) {
private static bool SupportedCombo(string verb, string bodyType, string extensionType) {
switch (verb) {
case "Get":
case "Head":
case "Delete":
return false;
default:
case null: // Send
return bodyType != null || extensionType != "FlurlClient";
case "Post":
return true;
case "Put":
case "Patch":
return bodyType != "UrlEncoded";
default: // Get, Head, Delete
return bodyType == null;
}
}
@ -53,12 +51,9 @@ namespace Flurl.Http.CodeGen
public string BodyType { get; set; }
public string ExtentionOfType { get; set; }
public string DeserializeToType { get; set; }
public bool HasCancelationToken { get; set; }
public bool IsGeneric { get; set; }
public string Name {
get { return string.Format("{0}{1}Async", HttpVerb, BodyType ?? DeserializeToType); }
}
public string Name => $"{HttpVerb ?? "Send"}{BodyType ?? DeserializeToType}Async";
public string TaskArg {
get {

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>d27d66c8-240d-4b7f-a9fe-b10e237668a1</ProjectGuid>
<RootNamespace>Flurl.Http.CodeGen</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Flurl.Http.CodeGen
{
class Program
{
static int Main(string[] args) {
var codePath = (args.Length > 0) ? args[0] : @"..\Flurl.Http.Shared\HttpExtensions.cs";
if (!File.Exists(codePath)) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Code file not found: " + Path.GetFullPath(codePath));
return 2;
}
try {
File.WriteAllText(codePath, "");
using (var writer = new CodeWriter(codePath))
{
writer
.WriteLine("// This file was auto-generated by Flurl.Http.CodeGen. Do not edit directly.")
.WriteLine()
.WriteLine("using System.Collections.Generic;")
.WriteLine("using System.IO;")
.WriteLine("using System.Net.Http;")
.WriteLine("using System.Threading;")
.WriteLine("using System.Threading.Tasks;")
.WriteLine("using Flurl.Http.Content;")
.WriteLine("")
.WriteLine("namespace Flurl.Http")
.WriteLine("{")
.WriteLine(" /// <summary>")
.WriteLine("/// Http extensions for Flurl Client.")
.WriteLine("/// </summary>")
.WriteLine("public static class HttpExtensions")
.WriteLine("{");
WriteExtensionMethods(writer);
writer
.WriteLine("}")
.WriteLine("}");
}
Console.WriteLine("File writing succeeded.");
return 0;
}
catch (Exception ex) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
return 2;
}
}
private static void WriteExtensionMethods(CodeWriter writer)
{
string name = null;
foreach (var xm in ExtensionMethodModel.GetAll()) {
var hasRequestBody = (xm.HttpVerb == "Post" || xm.HttpVerb == "Put" || xm.HttpVerb == "Patch" || xm.HttpVerb == null);
if (xm.Name != name) {
Console.WriteLine($"writing {xm.Name}...");
name = xm.Name;
}
writer.WriteLine("/// <summary>");
var summaryStart = (xm.ExtentionOfType == "FlurlClient") ? "Sends" : "Creates a FlurlClient from the URL and sends";
if (xm.HttpVerb == null)
writer.WriteLine("/// @0 an asynchronous request.", summaryStart);
else
writer.WriteLine("/// @0 an asynchronous @1 request.", summaryStart, xm.HttpVerb.ToUpperInvariant());
writer.WriteLine("/// </summary>");
if (xm.ExtentionOfType == "FlurlClient")
writer.WriteLine("/// <param name=\"client\">The Flurl client.</param>");
if (xm.ExtentionOfType == "Url" || xm.ExtentionOfType == "string")
writer.WriteLine("/// <param name=\"url\">The URL.</param>");
if (xm.HttpVerb == null)
writer.WriteLine("/// <param name=\"verb\">The HTTP method used to make the request.</param>");
if (xm.BodyType != null)
writer.WriteLine("/// <param name=\"data\">Contents of the request body.</param>");
else if (hasRequestBody)
writer.WriteLine("/// <param name=\"content\">Contents of the request body.</param>");
writer.WriteLine("/// <param name=\"cancellationToken\">A cancellation token that can be used by other objects or threads to receive notice of cancellation. Optional.</param>");
writer.WriteLine("/// <param name=\"completionOption\">The HttpCompletionOption used in the request. Optional.</param>");
writer.WriteLine("/// <returns>A Task whose result is @0.</returns>", xm.ReturnTypeDescription);
var args = new List<string>();
args.Add("this " + xm.ExtentionOfType + (xm.ExtentionOfType == "FlurlClient" ? " client" : " url"));
if (xm.HttpVerb == null)
args.Add("HttpMethod verb");
if (xm.BodyType != null)
args.Add((xm.BodyType == "String" ? "string" : "object") + " data");
else if (hasRequestBody)
args.Add("HttpContent content");
// http://stackoverflow.com/questions/22359706/default-parameter-for-cancellationtoken
args.Add("CancellationToken cancellationToken = default(CancellationToken)");
args.Add("HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead");
writer.WriteLine("public static Task<@0> @1@2(@3) {", xm.TaskArg, xm.Name, xm.IsGeneric ? "<T>" : "", string.Join(", ", args));
if (xm.ExtentionOfType == "FlurlClient")
{
args.Clear();
args.Add(
xm.HttpVerb == null ? "verb" :
xm.HttpVerb == "Patch" ? "new HttpMethod(\"PATCH\")" : // there's no HttpMethod.Patch
"HttpMethod." + xm.HttpVerb);
if (xm.BodyType != null || hasRequestBody)
args.Add("content: content");
args.Add("cancellationToken: cancellationToken");
args.Add("completionOption: completionOption");
if (xm.BodyType != null) {
writer.WriteLine("var content = new Captured@0Content(@1);",
xm.BodyType,
xm.BodyType == "String" ? "data" : string.Format("client.Settings.{0}Serializer.Serialize(data)", xm.BodyType));
}
var client = (xm.ExtentionOfType == "FlurlClient") ? "client" : "new FlurlClient(url, false)";
var receive = (xm.DeserializeToType == null) ? "" : string.Format(".Receive{0}{1}()", xm.DeserializeToType, xm.IsGeneric ? "<T>" : "");
writer.WriteLine("return @0.SendAsync(@1)@2;", client, string.Join(", ", args), receive);
}
else
{
writer.WriteLine("return new FlurlClient(url, false).@0(@1);",
xm.Name + (xm.IsGeneric ? "<T>" : ""),
string.Join(", ", args.Skip(1).Select(a => a.Split(' ')[1])));
}
writer.WriteLine("}").WriteLine();
}
}
}
}

View File

@ -0,0 +1,17 @@
{
"buildOptions": {
"emitEntryPoint": true,
"optimize": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"frameworks": {
"netcoreapp1.0": { }
}
}

View File

@ -4,19 +4,19 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>52c8c00d-9bd2-4642-b103-f0a8c564fe05</ProjectGuid>
<RootNamespace>Flurl.Http</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Some files were not shown because too many files have changed in this diff Show More