【发布时间】:2015-07-23 00:03:30
【问题描述】:
我有一个对 RESTful API 的请求(注意,Invoke-WebRequest 和 Invoke-RestMethod 都会发生这种情况):
$resp1 = Invoke-WebRequest -OutFile $clusterConfigZipFile -Uri $apiFolder -Body $fileContent -Method 'POST' -Credential $adminCredentials -ContentType "application/x-www-form-urlencoded" -ErrorAction SilentlyContinue -Verbose
我知道它可以正常工作,因为:
我的问题是 $resp1 中的代码没有返回任何内容。我有read,当您使用-OutFile 时,它是一个“功能”。
有没有办法在 PowerShell 中捕获响应或至少响应代码?
【问题讨论】:
标签: rest powershell powershell-3.0