Browse Source

Update the System.Net.Http integrations to support HttpRequestMessage.VersionPolicy

pull/1450/head
Kévin Chalet 4 years ago
parent
commit
af9f6a66a2
  1. 1
      Directory.Build.targets
  2. 5
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs
  3. 5
      src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs

1
Directory.Build.targets

@ -82,6 +82,7 @@
<PropertyGroup <PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))) "> Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))) ">
<DefineConstants>$(DefineConstants);SUPPORTS_MULTIPLE_VALUES_IN_QUERYHELPERS</DefineConstants> <DefineConstants>$(DefineConstants);SUPPORTS_MULTIPLE_VALUES_IN_QUERYHELPERS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HTTP_CLIENT_DEFAULT_REQUEST_VERSION_POLICY</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup <PropertyGroup

5
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpHandlers.cs

@ -257,6 +257,11 @@ public static partial class OpenIddictClientSystemNetHttpHandlers
// If supported, import the HTTP version from the client instance. // If supported, import the HTTP version from the client instance.
request.Version = client.DefaultRequestVersion; request.Version = client.DefaultRequestVersion;
#endif #endif
#if SUPPORTS_HTTP_CLIENT_DEFAULT_REQUEST_VERSION_POLICY
// If supported, import the HTTP version policy from the client instance.
request.VersionPolicy = client.DefaultVersionPolicy;
#endif
HttpResponseMessage response; HttpResponseMessage response;
try try

5
src/OpenIddict.Validation.SystemNetHttp/OpenIddictValidationSystemNetHttpHandlers.cs

@ -256,6 +256,11 @@ public static partial class OpenIddictValidationSystemNetHttpHandlers
// If supported, import the HTTP version from the client instance. // If supported, import the HTTP version from the client instance.
request.Version = client.DefaultRequestVersion; request.Version = client.DefaultRequestVersion;
#endif #endif
#if SUPPORTS_HTTP_CLIENT_DEFAULT_REQUEST_VERSION_POLICY
// If supported, import the HTTP version policy from the client instance.
request.VersionPolicy = client.DefaultVersionPolicy;
#endif
HttpResponseMessage response; HttpResponseMessage response;
try try

Loading…
Cancel
Save