#544 adding net6.0 target
This commit is contained in:
parent
869e9c6acd
commit
d621980b3c
@ -19,7 +19,7 @@
|
|||||||
<ProjectReference Include="..\..\src\Flurl.Http\Flurl.Http.csproj" />
|
<ProjectReference Include="..\..\src\Flurl.Http\Flurl.Http.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)'=='net461' Or '$(TargetFramework)'=='net472' Or '$(TargetFramework)'=='net48'">
|
<ItemGroup Condition="'$(TargetFramework)'=='net461' Or '$(TargetFramework)'=='net48'">
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -289,14 +289,12 @@ namespace Flurl.Test.UrlBuilder
|
|||||||
Assert.AreEqual(expected, url.ToString());
|
Assert.AreEqual(expected, url.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETCOREAPP1_1
|
|
||||||
[Test]
|
[Test]
|
||||||
public void url_ToString_uses_invariant_culture() {
|
public void url_ToString_uses_invariant_culture() {
|
||||||
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es-ES");
|
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es-ES");
|
||||||
var url = "http://www.mysite.com".SetQueryParam("x", 1.1);
|
var url = "http://www.mysite.com".SetQueryParam("x", 1.1);
|
||||||
Assert.AreEqual("http://www.mysite.com?x=1.1", url.ToString());
|
Assert.AreEqual("http://www.mysite.com?x=1.1", url.ToString());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void can_reset_to_root() {
|
public void can_reset_to_root() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net461;net472</TargetFrameworks>
|
<TargetFrameworks>net6.0;netstandard2.0;net461</TargetFrameworks>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>8.0</LangVersion>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
<PackageId>Flurl.Http</PackageId>
|
<PackageId>Flurl.Http</PackageId>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)'=='net461' Or '$(TargetFramework)'=='net472'">
|
<ItemGroup Condition="'$(TargetFramework)'=='net461'">
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
<PackageReference Include="System.Text.Json" Version="6.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -35,6 +35,20 @@ namespace Flurl.Http
|
|||||||
new HttpMessage(response).SetHeader(name, value, createContentIfNecessary);
|
new HttpMessage(response).SetHeader(name, value, createContentIfNecessary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if NET5_0_OR_GREATER // https://github.com/dotnet/docs/blob/main/includes/preprocessor-symbols.md
|
||||||
|
/// <summary>
|
||||||
|
/// Associate a FlurlCall object with this request
|
||||||
|
/// </summary>
|
||||||
|
internal static void SetFlurlCall(this HttpRequestMessage request, FlurlCall call) {
|
||||||
|
request?.Options.Set(new HttpRequestOptionsKey<FlurlCall>("FlurlHttpCall"), call);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the FlurlCall associated with this request, if any.
|
||||||
|
/// </summary>
|
||||||
|
internal static FlurlCall GetFlurlCall(this HttpRequestMessage request) =>
|
||||||
|
request?.Options.TryGetValue(new HttpRequestOptionsKey<FlurlCall>("FlurlHttpCall"), out var call) == true ? call : null;
|
||||||
|
#else
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Associate a FlurlCall object with this request
|
/// Associate a FlurlCall object with this request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -46,11 +60,9 @@ namespace Flurl.Http
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the FlurlCall associated with this request, if any.
|
/// Get the FlurlCall associated with this request, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static FlurlCall GetFlurlCall(this HttpRequestMessage request) {
|
internal static FlurlCall GetFlurlCall(this HttpRequestMessage request) =>
|
||||||
if (request?.Properties != null && request.Properties.TryGetValue("FlurlHttpCall", out var obj) && obj is FlurlCall call)
|
request?.Properties?.TryGetValue("FlurlHttpCall", out var call) == true ? call as FlurlCall : null;
|
||||||
return call;
|
#endif
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetHeader(this HttpMessage msg, string name, object value, bool createContentIfNecessary) {
|
private static void SetHeader(this HttpMessage msg, string name, object value, bool createContentIfNecessary) {
|
||||||
switch (name.ToLower()) {
|
switch (name.ToLower()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user