Skip to content

Commit

Permalink
add response content validation
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Jul 25, 2023
1 parent 2ee6b5c commit 2931f5c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libraries/Microsoft.Bot.Connector/Teams/TeamsOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,14 +699,17 @@ private static RetryParams HandleThrottlingException(Exception ex, int currentRe
//201: created
try
{
responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

if (typeof(T) == typeof(string))
if (httpResponse.Content != null)
{
responseContent = JsonConvert.SerializeObject(responseContent, Client.SerializationSettings);
}
responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

result.Body = JsonConvert.DeserializeObject<T>(responseContent, Client.DeserializationSettings);
if (typeof(T) == typeof(string))
{
responseContent = JsonConvert.SerializeObject(responseContent, Client.SerializationSettings);
}

result.Body = JsonConvert.DeserializeObject<T>(responseContent, Client.DeserializationSettings);
}
}
catch (JsonException ex)
{
Expand Down

0 comments on commit 2931f5c

Please sign in to comment.