Skip to content

Commit

Permalink
Allow content to be null for GET Requests (#332)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
georgend and George authored Aug 12, 2020
1 parent 9b2e855 commit 774d9d4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 774d9d4

Please sign in to comment.