You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
443 B
12 lines
443 B
// Middleware to validate that a repo provider URL is supported.
|
|
const REPO_PLATFORMS = ["github", "gitlab"];
|
|
|
|
function isSupportedRepoProvider(request, response, next) {
|
|
const { repo_platform = null } = request.params;
|
|
if (!repo_platform || !REPO_PLATFORMS.includes(repo_platform))
|
|
return response
|
|
.status(500)
|
|
.text(`Unsupported repo platform ${repo_platform}`);
|
|
next();
|
|
}
|
|
module.exports = { isSupportedRepoProvider };
|