File tree 1 file changed +4
-4
lines changed
examples/typescript-ex/src
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" ;
2
2
3
3
export function doSomeStuff ( ) : void {
4
4
const myevent : CloudEventV1 = new CloudEvent ( {
@@ -21,7 +21,7 @@ export function doSomeStuff(): void {
21
21
22
22
// Typically used with an incoming HTTP request where myevent.format() is the actual
23
23
// 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 } ) ) ;
25
25
26
26
// ------ receiver binary
27
27
const data = {
@@ -38,8 +38,8 @@ export function doSomeStuff(): void {
38
38
"ce-extension1" : "extension1" ,
39
39
} ;
40
40
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 } ) ) ;
43
43
44
44
}
45
45
You can’t perform that action at this time.
0 commit comments