Skip to content

Commit

Permalink
Make sure IRequest extension methods invoke their IResponse counterpart
Browse files Browse the repository at this point in the history
(cherry picked from commit 5644cc4)
  • Loading branch information
Jericho committed Jan 8, 2022
1 parent 46117f4 commit 838d9f2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/StrongGrid/Extensions/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ internal static Task<T> AsObject<T>(this IResponse response, string propertyName
/// <exception cref="SendGridException">An error occurred processing the response.</exception>
internal static async Task<T> AsObject<T>(this IRequest request, string propertyName = null, bool throwIfPropertyIsMissing = true, JsonConverter jsonConverter = null)
{
var response = await request.AsMessage().ConfigureAwait(false);
return await response.Content.AsObject<T>(propertyName, throwIfPropertyIsMissing, jsonConverter).ConfigureAwait(false);
var response = await request.AsResponse().ConfigureAwait(false);
return await response.AsObject<T>(propertyName, throwIfPropertyIsMissing, jsonConverter).ConfigureAwait(false);
}

/// <summary>Get a raw JSON object representation of the response, which can also be accessed as a <c>dynamic</c> value.</summary>
Expand All @@ -229,8 +229,8 @@ internal static Task<JObject> AsRawJsonObject(this IResponse response, string pr
/// <exception cref="SendGridException">An error occurred processing the response.</exception>
internal static async Task<JObject> AsRawJsonObject(this IRequest request, string propertyName = null, bool throwIfPropertyIsMissing = true)
{
var response = await request.AsMessage().ConfigureAwait(false);
return await response.Content.AsRawJsonObject(propertyName, throwIfPropertyIsMissing).ConfigureAwait(false);
var response = await request.AsResponse().ConfigureAwait(false);
return await response.AsRawJsonObject(propertyName, throwIfPropertyIsMissing).ConfigureAwait(false);
}

/// <summary>Get a raw JSON object representation of the response, which can also be accessed as a <c>dynamic</c> value.</summary>
Expand All @@ -244,8 +244,8 @@ internal static Task<JArray> AsRawJsonArray(this IResponse response, string prop
/// <exception cref="ApiException">An error occurred processing the response.</exception>
internal static async Task<JArray> AsRawJsonArray(this IRequest request, string propertyName = null, bool throwIfPropertyIsMissing = true)
{
var response = await request.AsMessage().ConfigureAwait(false);
return await response.Content.AsRawJsonArray(propertyName, throwIfPropertyIsMissing).ConfigureAwait(false);
var response = await request.AsResponse().ConfigureAwait(false);
return await response.AsRawJsonArray(propertyName, throwIfPropertyIsMissing).ConfigureAwait(false);
}

/// <summary>Asynchronously retrieve the JSON encoded content and convert it to a 'PaginatedResponse' object.</summary>
Expand Down

0 comments on commit 838d9f2

Please sign in to comment.