Skip to content

Commit 41517b2

Browse files
andrueastmanbaywet
andauthored
Update src/Microsoft.Graph.Core/Requests/BatchRequestBuilder.cs
Co-authored-by: Vincent Biret <vibiret@microsoft.com>
1 parent f15167a commit 41517b2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Microsoft.Graph.Core/Requests/BatchRequestBuilder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ private static async Task ThrowIfFailedResponseAsync(HttpResponseMessage httpRes
108108
{
109109
if (httpResponseMessage.IsSuccessStatusCode) return;
110110

111-
var contentTypeString = httpResponseMessage.Content?.Headers?.ContentType?.MediaType is { } contentTypeMediaType && !string.IsNullOrEmpty(contentTypeMediaType) ? contentTypeMediaType : string.Empty;
112-
if (httpResponseMessage.Content != null && contentTypeString.StartsWith(CoreConstants.MimeTypeNames.Application.Json, StringComparison.OrdinalIgnoreCase))
111+
if (httpResponseMessage is {Content.Headers.ContentType.MediaType: string contentTypeMediaType} && !string.IsNullOrEmpty(contentTypeMediaType) && contentTypeString.StartsWith(CoreConstants.MimeTypeNames.Application.Json, StringComparison.OrdinalIgnoreCase))
113112
{
114113
using var responseContent = await httpResponseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false);
115114
using var document = await JsonDocument.ParseAsync(responseContent).ConfigureAwait(false);

0 commit comments

Comments
 (0)