title: Weird behavior while invoking Rest call using Invoke-RestMethod on Powershell script
body: <p>I want to pass body(parameters) to Rest-call using <strong>Invoke-RestMethod</strong>(powershell script) in <strong>GET</strong> call. but I think it's not supported because of some security reasons(some RFC standards).</p>
  <p>But in single session, When I first use <strong>POST</strong> method and then if I use <strong>GET</strong> method then it works. but if I directly call get method then it's throwing below <strong>error</strong>.</p>
  <pre><code>Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send
  </code></pre>
  <p>So, Is there some information powershell stores after first call ? Also, Is there any way to pass parameters to &quot;GET&quot; Restcall in powershell script ?</p>
  <p>I've attached code snippet:
  this snippet is working.</p>
  <pre><code>Invoke-RestMethod 'https://test_url/url_path?param1=par' -Method 'POST' -Headers $headers
  
  Invoke-RestMethod 'https://test_url/url_path?param1=par' -Method 'GET' -Headers $headers  # works
  </code></pre>
  <p>but this throws the error,</p>
  <pre><code>Invoke-RestMethod 'https://test_url/url_path?param1=par' -Method 'GET' -Headers $headers #Not works
  </code></pre>