Skip to content

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

Closed

Description

@matthewchngshopback

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions