File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -183,23 +183,20 @@ var Unmarshaller02 = require("cloudevents-sdk/http/unmarshaller/v02");
183
183
// some parts were removed //
184
184
185
185
app .post (' /' , function (req , res ) {
186
- try {
187
- // Using the Unmarshaller
188
- var cloudevent =
189
- unmarshaller .unmarshall (req .body , req .headers );
186
+ unmarshaller .unmarshall (req .body , req .headers )
187
+ .then (cloudevent => {
190
188
191
- // pretty print
192
- console .log (" Event Accepted:" );
193
-
194
- res .status (201 )
195
- .send (" Event Accepted" );
196
- }catch (e) {
197
- console .error (e);
189
+ // TODO use the cloudevent
198
190
191
+ res .status (201 )
192
+ .send (" Event Accepted" );
193
+ })
194
+ .catch (err => {
195
+ console .error (err);
199
196
res .status (400 )
200
197
.header (" Content-Type" , " application/json" )
201
- .send (JSON .stringify (e ));
202
- }
198
+ .send (JSON .stringify (err ));
199
+ });
203
200
});
204
201
205
202
You can’t perform that action at this time.
0 commit comments