Add validation for monitor URL and update test case and api documentation accordingly
This commit is contained in:
1 parent
7f0d5d4255
commit
aee7e02587
4 files changed
+28
-5
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
getMonitorByIdQueryValidation,
|
||||
getMonitorsByTeamIdValidation,
|
||||
createMonitorBodyValidation,
|
||||
getMonitorURLByQueryValidation,
|
||||
editMonitorBodyValidation,
|
||||
getMonitorsAndSummaryByTeamIdParamValidation,
|
||||
getMonitorsAndSummaryByTeamIdQueryValidation,
|
||||
@@ -273,6 +274,13 @@ const createMonitor = async (req, res, next) => {
|
||||
* @throws {Error} If there is an error during the process, especially if there is a validation error (422).
|
||||
*/
|
||||
const checkEndpointResolution = async (req, res, next) => {
|
||||
try {
|
||||
await getMonitorURLByQueryValidation.validateAsync(req.query);
|
||||
} catch (error) {
|
||||
next(handleValidationError(error, SERVICE_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
let { monitorURL } = req.query;
|
||||
monitorURL = new URL(monitorURL);
|
||||
|
||||
Reference in new issue
Block a user