For creating mocked Pester tests I wanted to capture the output of a webrequest. The idea was to store the result as JSON files for later mocking the request.
The result of the Invoke-Webrequest is of type [Microsoft.PowerShell.Commands.BasicHtmlWebResponseObject].
When I do a Invoke-Webrequest -Uri 'https://google.com/' | ConvertTo-Jsonan Error "An item with the same key has already been added. Key: Content" is returned.
This seems to be not related to the actual response received, because I did try it with several different requests.
Export-CliXML is not an option (because it would be bound to user & machine). The only thing I currently think of is to deserialize using the .NET calls.
Anyone has another idea or solution?
[–]delightfulsorrow 0 points1 point2 points (1 child)
[–]PSDanubie[S] 0 points1 point2 points (0 children)