-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reverse the parameter order when invoking (#71)
To make it possible for functions to easily act as both HTTP and CloudEvent handler it's better to have any potential data as the second parameter. This change also makes use of a new bit of the cloudevents API to receive an incoming event, eliminating a transitive dependency on axios. Fixes: #62 Fixes: knative/func#194 (when updated in thetemplate) Signed-off-by: Lance Ball <[email protected]>
- Loading branch information
Showing
5 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = function testFunc(data, context) { | ||
module.exports = function testFunc(context, data) { | ||
if (context.cloudevent) return { message: data.message }; | ||
else return new Error('No cloud event received'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters