From 52c9f850e88c0054ed4f5cb5ff1f364fc2554664 Mon Sep 17 00:00:00 2001 From: Anders Bjerner Date: Thu, 5 Dec 2019 19:59:07 +0100 Subject: [PATCH] Added the GetResponse method to both IHttpClient and HttpClient --- src/Skybrud.Essentials.Http/Client/HttpClient.cs | 12 ++++++++++++ src/Skybrud.Essentials.Http/Client/IHttpClient.cs | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/src/Skybrud.Essentials.Http/Client/HttpClient.cs b/src/Skybrud.Essentials.Http/Client/HttpClient.cs index 51a36dd..477d086 100644 --- a/src/Skybrud.Essentials.Http/Client/HttpClient.cs +++ b/src/Skybrud.Essentials.Http/Client/HttpClient.cs @@ -886,6 +886,18 @@ public virtual IHttpResponse DoHttpRequest(HttpMethod method, string url, IHttpQ #region Other + /// + /// Returns the response of the request identified by the specified . + /// + /// The options for the request to the API. + /// An instanceo of representing the raw response. + public virtual IHttpResponse GetResponse(IHttpRequestOptions options) { + if (options == null) throw new ArgumentNullException(nameof(options)); + IHttpRequest request = options.GetRequest(); + PrepareHttpRequest(request); + return request.GetResponse(); + } + /// /// Virtual method that can be used for configuring a request. /// diff --git a/src/Skybrud.Essentials.Http/Client/IHttpClient.cs b/src/Skybrud.Essentials.Http/Client/IHttpClient.cs index af9800a..d4883d3 100644 --- a/src/Skybrud.Essentials.Http/Client/IHttpClient.cs +++ b/src/Skybrud.Essentials.Http/Client/IHttpClient.cs @@ -11,6 +11,13 @@ namespace Skybrud.Essentials.Http.Client { /// public interface IHttpClient { + /// + /// Returns the response of the request identified by the specified . + /// + /// The options for the request to the API. + /// An instanceo of representing the raw response. + IHttpResponse GetResponse(IHttpRequestOptions options); + #region DoHttpGetRequest ///