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

11 months ago
  1. // Middleware to validate that a repo provider URL is supported.
  2. const REPO_PLATFORMS = ["github", "gitlab"];
  3. function isSupportedRepoProvider(request, response, next) {
  4. const { repo_platform = null } = request.params;
  5. if (!repo_platform || !REPO_PLATFORMS.includes(repo_platform))
  6. return response
  7. .status(500)
  8. .text(`Unsupported repo platform ${repo_platform}`);
  9. next();
  10. }
  11. module.exports = { isSupportedRepoProvider };