PowerShell - RestMethod Code snippet doesn't work

Hi guys,

I use PowerShell - RestMethod Code Snippet to get PoserShell code.

But it doesn’t work.

Below is what concerns me:

  • The code doesn’t include Content-Type to the header if it’s set
  • The code uses the below

$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
$stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new(“form-data”)
$stringHeader.Name = “solutionName”
$stringContent = [System.Net.Http.StringContent]::new(“SK”)
$stringContent.Headers.ContentDisposition = $stringHeader
$multipartContent.Add($stringContent)

to create “multipart/form-data” but I don’t see correct body in Fiddler, just

System.Net.Http.StringContent

Thanks

Hey @osiuser :wave:

Could you raise a new issue on the code generators repo, please?

Thanks @danny-dainton I’ve logged PowerShell - RestMethod Code snippet doesn’t work · Issue #763 · postmanlabs/postman-code-generators · GitHub

1 Like