From a046e268bcc559c7aaec00ce88f24de2cd7f1194 Mon Sep 17 00:00:00 2001 From: eumikhailov Date: Thu, 13 Aug 2020 01:42:16 +0300 Subject: [PATCH] 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 +}