@@ -285,7 +285,7 @@ describe("HTTP Transport Binding Binary Receiver for CloudEvents v0.2", () => {
285285 . to . equal ( "http://schema.registry/v1" ) ;
286286 } ) ;
287287
288- it ( "Cloudevent contains 'contenttype'" , ( ) => {
288+ it ( "Cloudevent contains 'contenttype' (application/json) " , ( ) => {
289289 // setup
290290 var payload = {
291291 "data" : "dataString"
@@ -308,7 +308,28 @@ describe("HTTP Transport Binding Binary Receiver for CloudEvents v0.2", () => {
308308 . to . equal ( "application/json" ) ;
309309 } ) ;
310310
311- it ( "Cloudevent contains 'data'" , ( ) => {
311+ it ( "Cloudevent contains 'contenttype' (application/octet-stream)" , ( ) => {
312+ // setup
313+ var payload = "The payload is binary data" ;
314+ var attributes = {
315+ "ce-type" : "type" ,
316+ "ce-specversion" : "0.2" ,
317+ "ce-source" : "/source" ,
318+ "ce-id" : "id" ,
319+ "ce-time" : "2019-06-16T11:42:00Z" ,
320+ "ce-schemaurl" : "http://schema.registry/v1" ,
321+ "Content-Type" : "application/octet-stream"
322+ } ;
323+
324+ // act
325+ var actual = receiver . parse ( payload , attributes ) ;
326+
327+ // assert
328+ expect ( actual . getContenttype ( ) )
329+ . to . equal ( "application/json" ) ;
330+ } ) ;
331+
332+ it ( "Cloudevent contains 'data' (application/json)" , ( ) => {
312333 // setup
313334 var payload = {
314335 "data" : "dataString"
@@ -331,6 +352,27 @@ describe("HTTP Transport Binding Binary Receiver for CloudEvents v0.2", () => {
331352 . to . deep . equal ( payload ) ;
332353 } ) ;
333354
355+ it ( "Cloudevent contains 'data' (application/octet-stream)" , ( ) => {
356+ // setup
357+ var payload = "The payload is binary data" ;
358+ var attributes = {
359+ "ce-type" : "type" ,
360+ "ce-specversion" : "0.2" ,
361+ "ce-source" : "/source" ,
362+ "ce-id" : "id" ,
363+ "ce-time" : "2019-06-16T11:42:00Z" ,
364+ "ce-schemaurl" : "http://schema.registry/v1" ,
365+ "Content-Type" : "application/octet-stream"
366+ } ;
367+
368+ // act
369+ var actual = receiver . parse ( payload , attributes ) ;
370+
371+ // assert
372+ expect ( actual . getData ( ) )
373+ . to . deep . equal ( payload ) ;
374+ } ) ;
375+
334376 it ( "No error when all attributes are in place" , ( ) => {
335377 // setup
336378 var payload = {
0 commit comments