@@ -27,13 +27,19 @@ function Get-Document {
27
27
}
28
28
' https' {
29
29
Write-Verbose " Incoming HTTPs path" ;
30
- Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json ;
30
+ $Response = Invoke-WebRequest - UseBasicParsing - Uri $Path ;
31
31
}
32
32
' http' {
33
33
Write-Verbose " Incoming HTTP path" ;
34
- Invoke-WebRequest - UseBasicParsing - Uri $Path | Select-Object - ExpandProperty Content | ConvertFrom-Json ;
34
+ $Response = Invoke-WebRequest - UseBasicParsing - Uri $Path ;
35
35
}
36
36
}
37
+ if ($Response.Content.GetType ().Name -eq ' Byte[]' ) {
38
+ [string ]::new($Response.Content ) | ConvertFrom-Json ;
39
+ }
40
+ else {
41
+ $Response.Content | ConvertFrom-Json
42
+ }
37
43
}
38
44
catch {
39
45
throw $_ ;
@@ -51,7 +57,7 @@ function Get-Object {
51
57
)
52
58
53
59
process {
54
- Write-Verbose ($SchemaDocument | Out-String );
60
+ Write-Verbose ($SchemaDocument | Out-String );
55
61
$Properties = $SchemaDocument.properties | Get-Member - MemberType NoteProperty | Select-Object - ExpandProperty Name;
56
62
Write-Verbose " Setting up output object" ;
57
63
$Members = @ {};
@@ -99,7 +105,7 @@ function Get-Array {
99
105
)
100
106
101
107
process {
102
- Write-Verbose ($SchemaDocument | Out-String );
108
+ Write-Verbose ($SchemaDocument | Out-String );
103
109
$Properties = $SchemaDocument.items.anyOf.properties | Get-Member - MemberType NoteProperty | Select-Object - ExpandProperty Name;
104
110
Write-Verbose " Setting up output object" ;
105
111
$Members = @ {};
@@ -148,7 +154,7 @@ function Get-Property {
148
154
)
149
155
150
156
process {
151
- Write-Verbose ($SchemaDocument | Out-String );
157
+ Write-Verbose ($SchemaDocument | Out-String );
152
158
Write-Verbose $Name ;
153
159
if ($Name ) {
154
160
Write-Verbose " Return specific Property" ;
0 commit comments