Skip to content

Binary mode header missing extension attribute when the value is false (boolean) #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthewchngshopback opened this issue Jun 2, 2022 · 0 comments · Fixed by #493
Closed

Comments

@matthewchngshopback
Copy link

matthewchngshopback commented Jun 2, 2022

When an extension attribute contains a boolean false value, it does not appear in the binary mode HTTP headers.

Steps to Reproduce

const { CloudEvent, HTTP } = require("cloudevents")

const ce = new CloudEvent({ type: 'test', source:'testor', exttrue: true, extfalse: false, extstring: 'false' })
const { headers } = HTTP.binary(ce)

console.log(headers)
// Prints:
// {
//   'content-type': 'application/json; charset=utf-8',
//   'ce-id': '1dcf7357-3896-42d8-afb6-21162d88d550',
//   'ce-time': '2022-06-02T16:07:03.729Z',
//   'ce-type': 'test',
//   'ce-source': 'testor',
//   'ce-specversion': '1.0',
//   'ce-exttrue': true,
//   'ce-extstring': 'false'
// }

Expected Behavior
Headers should include expected ce-extfalse: false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant