Skip to content

Commit 3334de5

Browse files
authored
Merge pull request #496 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents dc9d9cb + 8743156 commit 3334de5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecPartnerWebhook.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Invoke-ExecPartnerWebhook {
55
.ROLE
66
CIPP.AppSettings.ReadWrite
77
#>
8-
Param($Request, $TriggerMetadata)
8+
param($Request, $TriggerMetadata)
99
switch ($Request.Query.Action) {
1010
'ListEventTypes' {
1111
$Uri = 'https://api.partnercenter.microsoft.com/webhooks/v1/registration/events'
@@ -72,7 +72,7 @@ function Invoke-ExecPartnerWebhook {
7272
}
7373
}
7474

75-
return @{
75+
return [HttpResponseContext]@{
7676
StatusCode = [System.Net.HttpStatusCode]::OK
7777
Body = $Body
7878
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/New-CippCoreRequest.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ function New-CippCoreRequest {
5050
return ([HttpResponseContext]($HttpResponse | Select-Object -First 1))
5151
} else {
5252
# If no valid response context found, create a default success response
53-
return ([HttpResponseContext]@{
54-
StatusCode = [HttpStatusCode]::OK
55-
Body = $Response
56-
})
53+
if ($Response.PSObject.Properties.Name -contains 'StatusCode' -and $Response.PSObject.Properties.Name -contains 'Body') {
54+
return ([HttpResponseContext]@{
55+
StatusCode = $Response.StatusCode
56+
Body = $Response.Body
57+
})
58+
} else {
59+
return ([HttpResponseContext]@{
60+
StatusCode = [HttpStatusCode]::OK
61+
Body = $Response
62+
})
63+
}
5764
}
5865
}
5966
} catch {

0 commit comments

Comments
 (0)