2

I'm trying to debug a multi-part/formdata HTTP request being sent to an api in Powershell, I want to see what powershell actually sends in the form of a HTTP request to the server.

So far im just setting a variable to my request but am only able to retrieve the response which im not interested in as my request returns an error.

This is my request:

$resp = Invoke-RestMethod -Uri $url -Headers $headers -Method "Post" - 
ContentType "multipart/form-data; boundary=$boundary" -Body $bodyLines

Any help is appreciated.

  • 2
    Fiddler configured as the system proxy server, or out of the box - Wireshark/Microsoft Message Analyser or any other packet capture software. – Alex K. Jun 25 '19 at 15:22
  • 1
    Run a [PowerShell TCP listener](https://stackoverflow.com/q/44518636/478656) in one shell, and your `Invoke-RestMethod` call in another, with `-Uri http://localhost:8989` (or whichever port you configure). That will print out what the server receives. – TessellatingHeckler Jun 25 '19 at 16:07
  • 1
    @AlexK. Fiddler worked great and I was able to get my request working, thank you very much. – Anthony Vespoli Jun 25 '19 at 16:15

0 Answers0