Skip to content

Commit

Permalink
(GH-367) Make sure IRequest extension methods invoke their IResponse …
Browse files Browse the repository at this point in the history
…counterpart
  • Loading branch information
Jericho committed Jan 24, 2021
1 parent d1370dd commit 362591c
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 @@ -198,8 +198,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 @@ -213,8 +213,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 @@ -228,8 +228,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 362591c

Please sign in to comment.