Describe the bug
ConvertFrom-HttpMessage produces a CloundEvent with empty fields when Content-Type is application/x-www-form-urlencoded
To Reproduce
Steps to reproduce the behavior:
$unsupportedContentFormat = 'application/x-www-form-urlencoded'
$expectedType = 'test'
$expectedSource = 'urn:test'
$expectedDataContentType = 'application/xml'
$expectedData = [Text.Encoding]::UTF8.GetBytes('<much wow="xml"/>')
$headers = @{
'Content-Type' = $unsupportedContentFormat
}
$structuredJsonBody = @{
'specversion' = $expectedSpecVersion
'type' = $expectedType
'source' = $expectedSource
'datacontenttype' = $expectedDataContentType
'data' = $expectedData
}
$body = [Text.Encoding]::UTF8.GetBytes(($structuredJsonBody | ConvertTo-Json))
ConvertFrom-HttpMessage `
-Headers $headers `
-Body $body
Expected behavior
$null as the HTTP message is no a cloud event. This is the behavior when no headers are specified.
Affected version
0.3.0
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
This issue is the root cause of vmware-archive/vcenter-event-broker-appliance#543