diff --git a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache index a8af6c94f329..be2916809892 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache @@ -185,7 +185,7 @@ function DeserializeResponse { [string[]]$ContentTypes ) - If ([string]::IsNullOrEmpty($ReturnType)) { # void response + If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response return $Response } Elseif ($ReturnType -match '\[\]$') { # array return ConvertFrom-Json $Response diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 index 64e1407872c6..b090a4b04213 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 @@ -172,7 +172,7 @@ function DeserializeResponse { [string[]]$ContentTypes ) - If ([string]::IsNullOrEmpty($ReturnType)) { # void response + If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response return $Response } Elseif ($ReturnType -match '\[\]$') { # array return ConvertFrom-Json $Response