chore: add test for text/plain data (#442)

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2021-11-23 18:05:15 -05:00 committed by GitHub
parent f7b2840f82
commit b4266b1f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,19 @@ describe("HTTP transport", () => {
expect(HTTP.isEvent(message)).to.be.true; expect(HTTP.isEvent(message)).to.be.true;
}); });
it("Handles CloudEvents with datacontenttype of text/plain", () => {
const message: Message = HTTP.binary(
new CloudEvent({
source: "/test",
type: "example",
datacontenttype: "text/plain",
data: "Hello, friends!",
}),
);
const event = HTTP.toEvent(message);
expect(event.validate()).to.be.true;
});
it("Respects extension attribute casing (even if against spec)", () => { it("Respects extension attribute casing (even if against spec)", () => {
// Now create a message that is an event // Now create a message that is an event
const message = { const message = {