在Powershell脚本上使用Invoke RestMethod调用Rest调用时出现奇怪的行为

在Powershell脚本上使用Invoke RestMethod调用Rest调用时出现奇怪的行为,powershell,rest,get,invoke-restmethod,Powershell,Rest,Get,Invoke Restmethod,我想使用GET调用中的调用RestMethod(powershell脚本)将主体(参数)传递给Rest调用。但我认为由于一些安全原因(一些RFC标准),它不受支持 但在单个会话中,当我第一次使用POST方法,然后如果我使用GET方法,它就会工作。但如果我直接调用get方法,那么它就会抛出错误 Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send 那么,在第

我想使用GET调用中的调用RestMethod(powershell脚本)将主体(参数)传递给Rest调用。但我认为由于一些安全原因(一些RFC标准),它不受支持

但在单个会话中,当我第一次使用POST方法,然后如果我使用GET方法,它就会工作。但如果我直接调用get方法,那么它就会抛出错误

Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send
那么,在第一次呼叫后是否有一些powershell存储信息?另外,是否有任何方法可以在powershell脚本中传递参数以“获取”Restcall

我已附上代码片段: 这段代码正在运行

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
但这会造成错误

Invoke-RestMethod 'https://test_url/url_path?param1=par' -Method 'GET' -Headers $headers #Not works

也许这会对@codebrane有所帮助,我尝试了博客中提到的同样的东西,但仍然得到了同样的错误。您知道我们可以使用powershell脚本中的参数调用get方法的其他库/方法吗?