-
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.
feat: Add tests for permission checks and response accept header
- Loading branch information
Showing
8 changed files
with
121 additions
and
16 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,30 @@ | ||
const debug = require("debug")("Blocks:CustomRoute") | ||
|
||
module.exports = { | ||
method: "GET", | ||
path: "/dont-allow", | ||
|
||
/** | ||
* Permission checking, if allowed: | ||
* -> continue to action | ||
* -> otherwise return 403 | ||
* | ||
* @param {Object} plugins Plugins | ||
* @param {Object} req Node request | ||
* | ||
* @return {boolean} | ||
*/ | ||
isAllowed: () => () => false, | ||
|
||
/** | ||
* After schema validation and permission checking, do route logic | ||
* | ||
* @param {Object} plugins Plugins | ||
* @param {Object} req Node request | ||
* | ||
* @return {mixed} | ||
*/ | ||
action: () => () => ({ | ||
ping: "pong", | ||
}), | ||
} |
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
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