Skip to content

Commit

Permalink
Added the GetResponse method to both IHttpClient and HttpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
abjerner committed Dec 5, 2019
1 parent e7a27e9 commit 52c9f85
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Skybrud.Essentials.Http/Client/HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,18 @@ public virtual IHttpResponse DoHttpRequest(HttpMethod method, string url, IHttpQ

#region Other

/// <summary>
/// Returns the response of the request identified by the specified <paramref name="options"/>.
/// </summary>
/// <param name="options">The options for the request to the API.</param>
/// <returns>An instanceo of <see cref="IHttpResponse"/> representing the raw response.</returns>
public virtual IHttpResponse GetResponse(IHttpRequestOptions options) {
if (options == null) throw new ArgumentNullException(nameof(options));
IHttpRequest request = options.GetRequest();
PrepareHttpRequest(request);
return request.GetResponse();
}

/// <summary>
/// Virtual method that can be used for configuring a request.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions src/Skybrud.Essentials.Http/Client/IHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ namespace Skybrud.Essentials.Http.Client {
/// </summary>
public interface IHttpClient {

/// <summary>
/// Returns the response of the request identified by the specified <paramref name="options"/>.
/// </summary>
/// <param name="options">The options for the request to the API.</param>
/// <returns>An instanceo of <see cref="IHttpResponse"/> representing the raw response.</returns>
IHttpResponse GetResponse(IHttpRequestOptions options);

#region DoHttpGetRequest

/// <summary>
Expand Down

0 comments on commit 52c9f85

Please sign in to comment.