title: PowerShell doesn't recognize provided parameter
body: <p>Operating System - <strong>Windows 10</strong></p>
  
  <p>Powershell version - <strong>5.1.15063.1088</strong></p>
  
  <p>I'm using <em>Windows PowerShell ISE</em> (if that makes any sense). When running simple HTTP Post function </p>
  
  <pre><code>Function MyBeautifulFunction {
  
    $myCredentials = Get-Credential
  
    $body = @{
            "query"="SELECT [System.Wheel],[System.SparkPlug],[System.EngineOil],[System.Headlight],[System.RadioButton] FROM JunkYard WHERE [System.Brand] = 'Ford' AND [System.Model] = 'GT' AND [System.Title] CONTAINS 'Rebuild'"
    } | ConvertTo-Json
  
    Invoke-RestMethod -Uri 'http://example.com//ford/parts/fuelpump/_apis/wit/wiql?api-version=2.0' `
      -Method Post `
      -Credential $myCredentials `
      -Body $body `
      -ContentType 'application/json' 
  
  }
  
  MyBeautifulFunction
  </code></pre>
  
  <p><sup>Editor's note: The <code>Invoke-RestMethod</code> call was originally spread across 2 lines without line continuation, which part of <a href="https://stackoverflow.com/a/50843879/45375">Adam's answer</a> below discusses.</sup></p>
  
  <p>I'm getting following error message in PowerShell ISE console window:</p>
  
  <pre><code>"message":"The request indicated a Content-Type of \"application/x-www-form-urlencoded\" for method type \"POST\" which is not supported. Valid 
  content types for this method are: application/json, application/json-patch+json.
  </code></pre>
  
  <p>It's clearly visible that I'm passing <code>'application/json'</code> in the parameter, but for some reason PowerShell still complains. Has anyone faced this error before? Should I report to Microsoft with it? Thanks for the advice...</p>