From 774d9d40a32570720c5fdba72187741452d8dc66 Mon Sep 17 00:00:00 2001 From: George <1641829+finsharp@users.noreply.github.com> Date: Wed, 12 Aug 2020 20:43:43 +0300 Subject: [PATCH] Allow content to be null for GET Requests (#332) * Powershell 5.0 does not allow GET Requests to have bodies. Parse HashTables as Json. * Null check for Content during Get Requests. Co-authored-by: George --- .../Authentication/Cmdlets/InvokeGraphRequest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs b/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs index 6268868a59e..9f66df3db5b 100644 --- a/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs +++ b/src/Authentication/Authentication/Cmdlets/InvokeGraphRequest.cs @@ -722,13 +722,13 @@ private void FillRequestStream(HttpRequestMessage request) { if (SkipHeaderValidation) { - request.Content.Headers.TryAddWithoutValidation(entry.Key, entry.Value); + request.Content?.Headers.TryAddWithoutValidation(entry.Key, entry.Value); } else { try { - request.Content.Headers.Add(entry.Key, entry.Value); + request.Content?.Headers.Add(entry.Key, entry.Value); } catch (FormatException ex) {