Merge pull request #638 from bluewave-labs/fix/getMonitorById
Updated parameters passed to for certificate check
This commit is contained in:
3 files changed
+2
-3
No files matched your search
@@ -77,7 +77,8 @@ const getMonitorCertificate = async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const monitor = await req.db.getMonitorById(req, res);
|
const { monitorId } = req.params;
|
||||||
|
const monitor = await req.db.getMonitorById(monitorId);
|
||||||
const monitorUrl = new URL(monitor.url);
|
const monitorUrl = new URL(monitor.url);
|
||||||
const certificate = await sslChecker(monitorUrl.hostname);
|
const certificate = await sslChecker(monitorUrl.hostname);
|
||||||
if (certificate && certificate.validTo) {
|
if (certificate && certificate.validTo) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const logger = require("../utils/logger");
|
|||||||
const { errorMessages } = require("../utils/messages");
|
const { errorMessages } = require("../utils/messages");
|
||||||
|
|
||||||
const handleErrors = (error, req, res, next) => {
|
const handleErrors = (error, req, res, next) => {
|
||||||
console.log(error);
|
|
||||||
const status = error.status || 500;
|
const status = error.status || 500;
|
||||||
const message = error.message || errorMessages.FRIENDLY_ERROR;
|
const message = error.message || errorMessages.FRIENDLY_ERROR;
|
||||||
const service = error.service || errorMessages.UNKNOWN_SERVICE;
|
const service = error.service || errorMessages.UNKNOWN_SERVICE;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ const verifyOwnership = (Model, paramName) => {
|
|||||||
|
|
||||||
// If the userID does not match the document's userID, return a 403 error
|
// If the userID does not match the document's userID, return a 403 error
|
||||||
if (userId.toString() !== doc.userId.toString()) {
|
if (userId.toString() !== doc.userId.toString()) {
|
||||||
console.log(userId.toString(), doc.userId.toString());
|
|
||||||
const error = new Error(errorMessages.VERIFY_OWNER_UNAUTHORIZED);
|
const error = new Error(errorMessages.VERIFY_OWNER_UNAUTHORIZED);
|
||||||
error.status = 403;
|
error.status = 403;
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in new issue
Block a user