diff --git a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs index 56e1429..3954916 100644 --- a/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs +++ b/src/Microsoft.OData.Extensions.Client/Internals/Handlers/HttpClientRequestMessage.cs @@ -151,6 +151,39 @@ public override ICredentials Credentials } } +#if !ASTORIA_LIGHT && !PORTABLELIB + /// + /// 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); + } + } + + /// + /// 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. /// @@ -255,6 +288,22 @@ public override IODataResponseMessage EndGetResponse(IAsyncResult asyncResult) return UnwrapAggregateException(() => new HttpClientResponseMessage(((Task)asyncResult).Result, this.config)); } +#if !ASTORIA_LIGHT && !PORTABLELIB + /// + /// Returns a response from an Internet resource. + /// + /// A System.Net.WebResponse that contains the response from the Internet resource. + public override IODataResponseMessage GetResponse() + { + return UnwrapAggregateException(() => + { + var send = CreateSendTask(); + send.Wait(); + return new HttpClientResponseMessage(send.Result, this.config); + }); + } +#endif + private Task CreateSendTask() { // Only set the message content if the stream has been written to, otherwise