Skip to content

Commit 37b7c80

Browse files
authored
null check on $ContentTypes (#9687)
1 parent 7125ef4 commit 37b7c80

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

modules/openapi-generator/src/main/resources/powershell/api_client.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ function DeserializeResponse {
211211
[string[]]$ContentTypes
212212
)
213213
214+
If ($ContentTypes -eq $null) {
215+
$ContentTypes = [string[]]@()
216+
}
217+
214218
If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response
215219
return $Response
216220
} Elseif ($ReturnType -match '\[\]$') { # array

samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ function DeserializeResponse {
198198
[string[]]$ContentTypes
199199
)
200200

201+
If ($ContentTypes -eq $null) {
202+
$ContentTypes = [string[]]@()
203+
}
204+
201205
If ([string]::IsNullOrEmpty($ReturnType) -and $ContentTypes.Count -eq 0) { # void response
202206
return $Response
203207
} Elseif ($ReturnType -match '\[\]$') { # array

0 commit comments

Comments
 (0)