-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: If route action returns null or undefined, respond with empty ob…
…ject
- Loading branch information
Showing
3 changed files
with
43 additions
and
11 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
method: "GET", | ||
path: "/return-undefined", | ||
|
||
/** | ||
* Permission checking, if allowed: | ||
* -> continue to action | ||
* -> otherwise return 403 | ||
* | ||
* @param {Object} plugins Plugins | ||
* @param {Object} req Node request | ||
* | ||
* @return {boolean} | ||
*/ | ||
isAllowed: (/* plugins */) => async () => true, | ||
|
||
/** | ||
* After schema validation and permission checking, do route logic | ||
* | ||
* @param {Object} plugins Plugins | ||
* @param {Object} req Node request | ||
* | ||
* @return {mixed} | ||
*/ | ||
action: () => () => {}, | ||
} |