From 6953800a30e2f981c94954a6075b0726be51532d Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 01:42:16 +0300 Subject: [PATCH 1/9] Fix HttpClientRequestMessage.cs DataServiceClientRequestMessage contracts have changed (https://github.com/OData/odata.net/blob/master/src/Microsoft.OData.Client/Serialization/DataServiceClientRequestMessage.cs). Sync it to https://github.com/OData/odata.net/blob/master/test/EndToEndTests/Tests/Client/Build.Desktop/TransportLayerTests/HttpClientRequestMessage.cs. More details in issue https://github.com/OData/Extensions/issues/37 --- .../Handlers/HttpClientRequestMessage.cs | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs index c3a9d84..92e2d29 100644 --- a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs +++ b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs @@ -150,6 +150,51 @@ public override ICredentials Credentials this.requestMessage.Properties[typeof(ICredentials).FullName] = value; } } + + /// + /// Gets or sets the timeout (in seconds) for this request. + /// + public override int Timeout + { + get + { + return (int)this.client.Timeout.TotalSeconds; + } + set + { + this.client.Timeout = new TimeSpan(0, 0, value); + } + } + + public override int ReadWriteTimeout + { + get + { + return (int)this.client.Timeout.TotalSeconds; + } + set + { + this.client.Timeout = new TimeSpan(0, 0, value); + } + } + +#if !(NETCOREAPP1_0 || NETCOREAPP2_0) + /// + /// Gets or sets a value that indicates whether to send data in segments to the Internet resource. + /// + public override bool SendChunked + { + get + { + bool? transferEncodingChunked = this.requestMessage.Headers.TransferEncodingChunked; + return transferEncodingChunked.HasValue && transferEncodingChunked.Value; + } + set + { + this.requestMessage.Headers.TransferEncodingChunked = value; + } + } +#endif /// /// Returns the value of the header with the given name. @@ -313,4 +358,4 @@ private static DataServiceTransportException ConvertToDataServiceWebException(We return new DataServiceTransportException(errorResponseMessage, webException); } } -} \ No newline at end of file +} From 4be5688160d6bbfdbbce46e186da85a2fb370c13 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:01:27 +0300 Subject: [PATCH 2/9] Update Microsoft.OData.Extensions.Client.Abstractions.csproj --- .../Microsoft.OData.Extensions.Client.Abstractions.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OData.Extensions.Client.Abstractions/Microsoft.OData.Extensions.Client.Abstractions.csproj b/src/Microsoft.OData.Extensions.Client.Abstractions/Microsoft.OData.Extensions.Client.Abstractions.csproj index 2d087ad..25c6bf3 100644 --- a/src/Microsoft.OData.Extensions.Client.Abstractions/Microsoft.OData.Extensions.Client.Abstractions.csproj +++ b/src/Microsoft.OData.Extensions.Client.Abstractions/Microsoft.OData.Extensions.Client.Abstractions.csproj @@ -9,7 +9,7 @@ ProductRoot=$(productBinPath);version=$(VERSION_SEMANITCS_CLIENT_ABSTRACTIONS) - $(NuspecProperties);ODataClientPackageDependency=7.6.0 + $(NuspecProperties);ODataClientPackageDependency=7.7.0 @@ -18,6 +18,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - \ No newline at end of file + From 0d8a2edd715c5efdde84d72c9b3fdd0c5ca02d73 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:02:01 +0300 Subject: [PATCH 3/9] Update ODataVerificationClient.csproj --- .../ODataVerificationClient/ODataVerificationClient.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj index 53caa52..ef91829 100644 --- a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj +++ b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj @@ -5,7 +5,7 @@ - + From 5f763f570e3e6fe075494f98048c47ae2fb50ac8 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:02:53 +0300 Subject: [PATCH 4/9] Update OData.Client.E2ETests.csproj --- .../OData.Client.E2ETests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/EndToEndTests/Tests/Microsoft.OData.Extensions.Client.E2ETests/OData.Client.E2ETests.csproj b/test/EndToEndTests/Tests/Microsoft.OData.Extensions.Client.E2ETests/OData.Client.E2ETests.csproj index 4b334b7..74599bf 100644 --- a/test/EndToEndTests/Tests/Microsoft.OData.Extensions.Client.E2ETests/OData.Client.E2ETests.csproj +++ b/test/EndToEndTests/Tests/Microsoft.OData.Extensions.Client.E2ETests/OData.Client.E2ETests.csproj @@ -13,7 +13,7 @@ - + @@ -35,4 +35,4 @@ - \ No newline at end of file + From 14c490ba6b2eb0ba47a6d12d1cb727a557e9c29f Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:08:48 +0300 Subject: [PATCH 5/9] Update HttpClientRequestMessage.cs --- .../Internals/Handlers/HttpClientRequestMessage.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs index 92e2d29..f7e48e7 100644 --- a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs +++ b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs @@ -299,6 +299,18 @@ public override IODataResponseMessage EndGetResponse(IAsyncResult asyncResult) { return UnwrapAggregateException(() => new HttpClientResponseMessage(((Task)asyncResult).Result, this.config)); } + +#if !PORTABLELIB && !(NETCOREAPP1_0 || NETCOREAPP2_0) + public override IODataResponseMessage GetResponse() + { + return UnwrapAggregateException(() => + { + var send = CreateSendTask(); + send.Wait(); + return ConvertHttpClientResponse(send.Result); + }); + } +#endif /// /// Dispose the object. From 9abf7954147694d7eb5a1ddbb158c5cd05a92a90 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:25:46 +0300 Subject: [PATCH 6/9] Update HttpClientRequestMessage.cs --- .../Internals/Handlers/HttpClientRequestMessage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs index f7e48e7..e157851 100644 --- a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs +++ b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs @@ -1,4 +1,4 @@ -//--------------------------------------------------------------------- +//--------------------------------------------------------------------- // // Copyright (c) .NET Foundation and Contributors. All rights reserved. See License.txt in the project root for license information. // @@ -307,7 +307,7 @@ public override IODataResponseMessage GetResponse() { var send = CreateSendTask(); send.Wait(); - return ConvertHttpClientResponse(send.Result); + return new HttpClientResponseMessage(send.Result, this.config); }); } #endif From 4947ebaacf71c44010278b6b72d2096a834c3da0 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:32:07 +0300 Subject: [PATCH 7/9] Update ODataVerificationClient.csproj --- .../ODataVerificationClient/ODataVerificationClient.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj index ef91829..16885aa 100644 --- a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj +++ b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj @@ -5,6 +5,7 @@ + From f6af7abfea895d8f64f34a3d635496cca186f48b Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 02:36:01 +0300 Subject: [PATCH 8/9] Update ODataVerificationClient.csproj --- .../ODataVerificationClient/ODataVerificationClient.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj index 16885aa..9a0a8f2 100644 --- a/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj +++ b/test/EndToEndTests/GeneratedClient/ODataVerificationClient/ODataVerificationClient.csproj @@ -5,7 +5,7 @@ - + From 16d1d0e8bc7852a70439c05db8bb1092afae1ddd Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Fri, 14 Aug 2020 10:31:58 +0300 Subject: [PATCH 9/9] Update HttpClientRequestMessage.cs --- .../Internals/Handlers/HttpClientRequestMessage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs index e157851..898f8c5 100644 --- a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs +++ b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs @@ -300,7 +300,7 @@ public override IODataResponseMessage EndGetResponse(IAsyncResult asyncResult) return UnwrapAggregateException(() => new HttpClientResponseMessage(((Task)asyncResult).Result, this.config)); } -#if !PORTABLELIB && !(NETCOREAPP1_0 || NETCOREAPP2_0) +#if !(NETCOREAPP1_0 || NETCOREAPP2_0) public override IODataResponseMessage GetResponse() { return UnwrapAggregateException(() =>