我想在GET调用中使用Invoke-RestMethod(powershell 脚本)将正文(参数)传递给 Rest- call。但我认为由于某些安全原因(某些 RFC 标准),它不受支持。
但是在单个会话中,当我第一次使用POST方法,然后如果我使用GET方法,那么它就可以工作。但是如果我直接调用 get 方法,那么它会抛出错误。
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send
那么,第一次通话后是否有一些信息 powershell 存储?另外,有没有办法在powershell脚本中将参数传递给“GET”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