File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
examples/typescript-ex/src Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1- import { CloudEvent , CloudEventV1 , Receiver } from "cloudevents" ;
1+ import { CloudEvent , CloudEventV1 , HTTP } from "cloudevents" ;
22
33export function doSomeStuff ( ) : void {
44 const myevent : CloudEventV1 = new CloudEvent ( {
@@ -21,7 +21,7 @@ export function doSomeStuff(): void {
2121
2222 // Typically used with an incoming HTTP request where myevent.format() is the actual
2323 // body of the HTTP
24- console . log ( "Received structured event:" , Receiver . accept ( headers , myevent ) ) ;
24+ console . log ( "Received structured event:" , HTTP . toEvent ( { headers, body : myevent } ) ) ;
2525
2626 // ------ receiver binary
2727 const data = {
@@ -38,8 +38,8 @@ export function doSomeStuff(): void {
3838 "ce-extension1" : "extension1" ,
3939 } ;
4040
41- console . log ( "My binary event:" , Receiver . accept ( attributes , data ) ) ;
42- console . log ( "My binary event extensions:" , Receiver . accept ( attributes , data ) ) ;
41+ console . log ( "My binary event:" , HTTP . toEvent ( { headers : attributes , body : data } ) ) ;
42+ console . log ( "My binary event extensions:" , HTTP . toEvent ( { headers : attributes , body : data } ) ) ;
4343
4444}
4545
You can’t perform that action at this time.
0 commit comments