From 8377285a271e1b631ce3b31d87f699a116f001bb Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Sun, 28 Apr 2024 19:52:57 +0100 Subject: [PATCH] Refactor API endpoints to use sendEmptySuccessResponse instead of sendEmptyResponse --- App/FeatureSet/Identity/API/Authentication.ts | 8 +- .../Identity/API/StatusPageAuthentication.ts | 6 +- App/FeatureSet/Notification/API/Call.ts | 4 +- App/FeatureSet/Notification/API/Mail.ts | 2 +- App/FeatureSet/Notification/API/SMS.ts | 4 +- App/FeatureSet/Notification/API/SMTPConfig.ts | 2 +- CommonServer/API/BaseAPI.ts | 4 +- CommonServer/API/BaseAnalyticsAPI.ts | 4 +- CommonServer/API/BillingInvoiceAPI.ts | 2 +- CommonServer/API/NotificationAPI.ts | 2 +- CommonServer/API/StatusPageAPI.ts | 6 +- CommonServer/API/StatusPageDomainAPI.ts | 205 ++++++++++++++++++ CommonServer/API/UserCallAPI.ts | 4 +- CommonServer/API/UserEmailAPI.ts | 4 +- CommonServer/API/UserSmsAPI.ts | 4 +- .../Services/StatusPageDomainService.ts | 37 +--- CommonServer/Tests/API/BaseAPI.test.ts | 6 +- CommonServer/Tests/API/ProbeAPI.test.ts | 2 +- CommonServer/Tests/API/ProjectAPI.test.ts | 2 +- CommonServer/Tests/API/UserSmsApi.test.ts | 6 +- CommonServer/Utils/Response.ts | 2 +- Ingestor/API/Alive.ts | 2 +- Ingestor/API/FluentIngest.ts | 2 +- Ingestor/API/IncomingRequest.ts | 2 +- Ingestor/API/OTelIngest.ts | 6 +- Ingestor/API/ServerMonitor.ts | 2 +- TestServer/API/Settings.ts | 2 +- 27 files changed, 251 insertions(+), 81 deletions(-) create mode 100644 CommonServer/API/StatusPageDomainAPI.ts diff --git a/App/FeatureSet/Identity/API/Authentication.ts b/App/FeatureSet/Identity/API/Authentication.ts index 6451e0279e..7970ae113f 100644 --- a/App/FeatureSet/Identity/API/Authentication.ts +++ b/App/FeatureSet/Identity/API/Authentication.ts @@ -275,7 +275,7 @@ router.post( logger.error(err); }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } return Response.sendErrorResponse( @@ -390,7 +390,7 @@ router.post( logger.error(err); }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } @@ -482,7 +482,7 @@ router.post( logger.error(err); }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } @@ -499,7 +499,7 @@ router.post( try { CookieUtil.removeAllCookies(req, res); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/App/FeatureSet/Identity/API/StatusPageAuthentication.ts b/App/FeatureSet/Identity/API/StatusPageAuthentication.ts index f280688ad9..b298794d7c 100644 --- a/App/FeatureSet/Identity/API/StatusPageAuthentication.ts +++ b/App/FeatureSet/Identity/API/StatusPageAuthentication.ts @@ -51,7 +51,7 @@ router.post( CookieUtil.getUserTokenKey(statusPageId) ); // remove the cookie. - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } @@ -178,7 +178,7 @@ router.post( logger.error(err); }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } throw new BadDataException( @@ -320,7 +320,7 @@ router.post( logger.error(err); }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/App/FeatureSet/Notification/API/Call.ts b/App/FeatureSet/Notification/API/Call.ts index e961a88c2f..2cac0bdaa7 100644 --- a/App/FeatureSet/Notification/API/Call.ts +++ b/App/FeatureSet/Notification/API/Call.ts @@ -32,7 +32,7 @@ router.post( customTwilioConfig: body['customTwilioConfig'] as any, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -137,7 +137,7 @@ router.post('/test', async (req: ExpressRequest, res: ExpressResponse) => { ); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); }); export default router; diff --git a/App/FeatureSet/Notification/API/Mail.ts b/App/FeatureSet/Notification/API/Mail.ts index 999a4d0584..c1996b36ca 100644 --- a/App/FeatureSet/Notification/API/Mail.ts +++ b/App/FeatureSet/Notification/API/Mail.ts @@ -44,7 +44,7 @@ router.post( (body['userOnCallLogTimelineId'] as ObjectID) || undefined, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); diff --git a/App/FeatureSet/Notification/API/SMS.ts b/App/FeatureSet/Notification/API/SMS.ts index ca9baf3c08..c20a954de9 100644 --- a/App/FeatureSet/Notification/API/SMS.ts +++ b/App/FeatureSet/Notification/API/SMS.ts @@ -35,7 +35,7 @@ router.post( } ); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -135,7 +135,7 @@ router.post('/test', async (req: ExpressRequest, res: ExpressResponse) => { ); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); }); export default router; diff --git a/App/FeatureSet/Notification/API/SMTPConfig.ts b/App/FeatureSet/Notification/API/SMTPConfig.ts index dbd309ee71..5da9187ea6 100644 --- a/App/FeatureSet/Notification/API/SMTPConfig.ts +++ b/App/FeatureSet/Notification/API/SMTPConfig.ts @@ -98,7 +98,7 @@ router.post('/test', async (req: ExpressRequest, res: ExpressResponse) => { ); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); }); export default router; diff --git a/CommonServer/API/BaseAPI.ts b/CommonServer/API/BaseAPI.ts index 9419c8d056..4356b8a792 100644 --- a/CommonServer/API/BaseAPI.ts +++ b/CommonServer/API/BaseAPI.ts @@ -342,7 +342,7 @@ export default class BaseAPI< props: await CommonAPI.getDatabaseCommonInteractionProps(req), }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } public async updateItem( @@ -370,7 +370,7 @@ export default class BaseAPI< props: await CommonAPI.getDatabaseCommonInteractionProps(req), }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } public async createItem( diff --git a/CommonServer/API/BaseAnalyticsAPI.ts b/CommonServer/API/BaseAnalyticsAPI.ts index 67b52df756..ea4e8e683f 100644 --- a/CommonServer/API/BaseAnalyticsAPI.ts +++ b/CommonServer/API/BaseAnalyticsAPI.ts @@ -340,7 +340,7 @@ export default class BaseAnalyticsAPI< props: await CommonAPI.getDatabaseCommonInteractionProps(req), }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } public async updateItem( @@ -370,7 +370,7 @@ export default class BaseAnalyticsAPI< props: await CommonAPI.getDatabaseCommonInteractionProps(req), }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } public async createItem( diff --git a/CommonServer/API/BillingInvoiceAPI.ts b/CommonServer/API/BillingInvoiceAPI.ts index d5d144ac91..20497583af 100644 --- a/CommonServer/API/BillingInvoiceAPI.ts +++ b/CommonServer/API/BillingInvoiceAPI.ts @@ -166,7 +166,7 @@ export default class UserAPI extends BaseAPI< }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { next(err); } diff --git a/CommonServer/API/NotificationAPI.ts b/CommonServer/API/NotificationAPI.ts index c7455e540c..ed77df1667 100644 --- a/CommonServer/API/NotificationAPI.ts +++ b/CommonServer/API/NotificationAPI.ts @@ -111,7 +111,7 @@ router.post( return Response.sendErrorResponse(req, res, err as Exception); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); diff --git a/CommonServer/API/StatusPageAPI.ts b/CommonServer/API/StatusPageAPI.ts index 65c7349cc1..c10676795f 100644 --- a/CommonServer/API/StatusPageAPI.ts +++ b/CommonServer/API/StatusPageAPI.ts @@ -125,7 +125,7 @@ export default class StatusPageAPI extends BaseAPI< ); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -1219,7 +1219,7 @@ export default class StatusPageAPI extends BaseAPI< ) => { try { await this.subscribeToStatusPage(req); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { next(err); } @@ -1265,7 +1265,7 @@ export default class StatusPageAPI extends BaseAPI< try { await this.subscribeToStatusPage(req); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { next(err); } diff --git a/CommonServer/API/StatusPageDomainAPI.ts b/CommonServer/API/StatusPageDomainAPI.ts new file mode 100644 index 0000000000..af205f826e --- /dev/null +++ b/CommonServer/API/StatusPageDomainAPI.ts @@ -0,0 +1,205 @@ +import StatusPageDomain from "Model/Models/StatusPageDomain"; +import BaseAPI from "./BaseAPI"; +import StatusPageDomainService, { + Service as StatusPageDomainServiceType, +} from '../Services/StatusPageDomainService'; +import { ExpressRequest, ExpressResponse } from "../Utils/Express"; +import BadDataException from "Common/Types/Exception/BadDataException"; +import Response from "../Utils/Response"; +import ObjectID from "Common/Types/ObjectID"; +import UserMiddleware from "../Middleware/UserAuthorization"; +import DatabaseCommonInteractionProps from "Common/Types/BaseDatabase/DatabaseCommonInteractionProps"; +import CommonAPI from "./CommonAPI"; + +export default class StatusPageAPI extends BaseAPI< + StatusPageDomain, + StatusPageDomainServiceType +> { + public constructor() { + super(StatusPageDomain, StatusPageDomainService); + + + // CNAME verification api. THis API will be used from the dashboard to validate the CNAME MANUALLY. + this.router.get( + `${new this.entityType() + .getCrudApiPath() + ?.toString()}/verify-cname/:id`, + UserMiddleware.getUserMiddleware, + async (req: ExpressRequest, res: ExpressResponse) => { + + const databaseProps: DatabaseCommonInteractionProps = + await CommonAPI.getDatabaseCommonInteractionProps(req); + + const id: ObjectID = new ObjectID(req.params['id'] as string); + + const domain: StatusPageDomain | null = + await StatusPageDomainService.findOneBy({ + query: { + id: id, + }, + select: { + _id: true, + fullDomain: true, + cnameVerificationToken: true, + }, + props: databaseProps, + }); + + if (!domain) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid token.') + ); + } + + if (!domain.cnameVerificationToken) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid token.') + ); + + } + + if (!domain.fullDomain) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid domain.') + ); + } + + const isValid = await StatusPageDomainService.isCnameValid(domain.fullDomain!, domain.cnameVerificationToken!); + + if (isValid) { + // mark as verified. + await StatusPageDomainService.updateOneById({ + id: domain.id!, + data: { + isCnameVerified: true, + }, + props: { + isRoot: true, + }, + }); + } + + return Response.sendEmptySuccessResponse(req, res); + } + ); + + // Provision SSL API. THis API will be used from the dashboard to validate the CNAME MANUALLY. + this.router.get( + `${new this.entityType() + .getCrudApiPath() + ?.toString()}/provision-ssl/:id`, + UserMiddleware.getUserMiddleware, + async (req: ExpressRequest, res: ExpressResponse) => { + + const databaseProps: DatabaseCommonInteractionProps = + await CommonAPI.getDatabaseCommonInteractionProps(req); + + const id: ObjectID = new ObjectID(req.params['id'] as string); + + const domain: StatusPageDomain | null = + await StatusPageDomainService.findOneBy({ + query: { + id: id, + }, + select: { + _id: true, + fullDomain: true, + cnameVerificationToken: true, + isCnameVerified: true, + isSslProvisioned: true, + }, + props: databaseProps, + }); + + if (!domain) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid token.') + ); + } + + if (!domain.cnameVerificationToken) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid token.') + ); + } + + + if(!domain.isCnameVerified){ + return Response.sendErrorResponse( + req, + res, + new BadDataException('CNAME is not verified. Please verify CNAME first before you provision SSL.') + ); + } + + if(domain.isSslProvisioned){ + return Response.sendErrorResponse( + req, + res, + new BadDataException('SSL is already provisioned.') + ); + } + + if (!domain.fullDomain) { + return Response.sendErrorResponse( + req, + res, + new BadDataException('Invalid domain.') + ); + } + + + // check cname again, just to be sure. + const isCnameValid = await StatusPageDomainService.isCnameValid(domain.fullDomain!, domain.cnameVerificationToken!); + + if(!isCnameValid){ + await StatusPageDomainService.updateOneById({ + id: domain.id!, + data: { + isCnameVerified: false, + }, + props: { + isRoot: true, + }, + }); + + return Response.sendErrorResponse( + req, + res, + new BadDataException('CNAME is not verified. Please verify CNAME first before you provision SSL.') + ); + } + + if (isCnameValid) { + // mark as verified. + await StatusPageDomainService.updateOneById({ + id: domain.id!, + data: { + isCnameVerified: true, + }, + props: { + isRoot: true, + }, + }); + } + + + + return Response.sendEmptySuccessResponse(req, res); + } + ); + } + + + +} diff --git a/CommonServer/API/UserCallAPI.ts b/CommonServer/API/UserCallAPI.ts index cef8178c44..0d2130f195 100644 --- a/CommonServer/API/UserCallAPI.ts +++ b/CommonServer/API/UserCallAPI.ts @@ -95,7 +95,7 @@ export default class UserCallAPI extends BaseAPI< }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -115,7 +115,7 @@ export default class UserCallAPI extends BaseAPI< await this.service.resendVerificationCode(req.body.itemId); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); } diff --git a/CommonServer/API/UserEmailAPI.ts b/CommonServer/API/UserEmailAPI.ts index 24c001cf32..f83ce304d2 100644 --- a/CommonServer/API/UserEmailAPI.ts +++ b/CommonServer/API/UserEmailAPI.ts @@ -94,7 +94,7 @@ export default class UserEmailAPI extends BaseAPI< }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -116,7 +116,7 @@ export default class UserEmailAPI extends BaseAPI< await this.service.resendVerificationCode(req.body.itemId); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); } diff --git a/CommonServer/API/UserSmsAPI.ts b/CommonServer/API/UserSmsAPI.ts index ed62aae732..c0777a036b 100644 --- a/CommonServer/API/UserSmsAPI.ts +++ b/CommonServer/API/UserSmsAPI.ts @@ -91,7 +91,7 @@ export default class UserSMSAPI extends BaseAPI { }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); @@ -111,7 +111,7 @@ export default class UserSMSAPI extends BaseAPI { await this.service.resendVerificationCode(req.body.itemId); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } ); } diff --git a/CommonServer/Services/StatusPageDomainService.ts b/CommonServer/Services/StatusPageDomainService.ts index a60fec027d..3bd3d7fda0 100644 --- a/CommonServer/Services/StatusPageDomainService.ts +++ b/CommonServer/Services/StatusPageDomainService.ts @@ -55,41 +55,6 @@ export class Service extends DatabaseService { return { createBy, carryForward: null }; } - protected override async onBeforeUpdate( - updateBy: UpdateBy - ): Promise> { - if (updateBy.props.isRoot) { - return { updateBy, carryForward: null }; - } - - if (updateBy.data.isCnameVerified) { - // check if cname is valid. - - const domain: Array = await this.findBy({ - query: updateBy.query, - select: { fullDomain: true, cnameVerificationToken: true }, - props: updateBy.props, - skip: 0, - limit: LIMIT_MAX, - }); - - for (const d of domain) { - const isValid: boolean = await this.isCnameValid( - d.fullDomain!, - d.cnameVerificationToken! - ); - - if (!isValid) { - throw new BadDataException( - `CNAME for this domain is not valid. Please add a CNAME record to ${d.fullDomain!}` - ); - } - } - } - - return { updateBy, carryForward: null }; - } - protected override async onBeforeDelete( deleteBy: DeleteBy ): Promise> { @@ -365,7 +330,7 @@ export class Service extends DatabaseService { } } - private async isCnameValid( + public async isCnameValid( fullDomain: string, token: string ): Promise { diff --git a/CommonServer/Tests/API/BaseAPI.test.ts b/CommonServer/Tests/API/BaseAPI.test.ts index b80800b4ed..9853377fa9 100644 --- a/CommonServer/Tests/API/BaseAPI.test.ts +++ b/CommonServer/Tests/API/BaseAPI.test.ts @@ -39,7 +39,7 @@ jest.mock('../../Utils/Response', () => { sendJsonObjectResponse: jest.fn().mockImplementation((...args: []) => { return args; }), - sendEmptyResponse: jest.fn(), + sendEmptySuccessResponse: jest.fn(), sendEntityResponse: jest.fn().mockImplementation((...args: []) => { return args; }), @@ -642,7 +642,7 @@ describe('BaseAPI', () => { await baseApiInstance.deleteItem(deleteRequest, res); const sendEmptyResponseSpy: jest.SpyInstance = jest.spyOn( Response as any, - 'sendEmptyResponse' + 'sendEmptySuccessResponse' ); expect(sendEmptyResponseSpy).toHaveBeenCalledWith( deleteRequest, @@ -737,7 +737,7 @@ describe('BaseAPI', () => { await baseApiInstance.updateItem(updateRequest, updateResponse); const sendEmptyResponseSpy: jest.SpyInstance = jest.spyOn( Response as any, - 'sendEmptyResponse' + 'sendEmptySuccessResponse' ); expect(sendEmptyResponseSpy).toHaveBeenCalledWith( updateRequest, diff --git a/CommonServer/Tests/API/ProbeAPI.test.ts b/CommonServer/Tests/API/ProbeAPI.test.ts index 70bcaef4e2..862a17550c 100644 --- a/CommonServer/Tests/API/ProbeAPI.test.ts +++ b/CommonServer/Tests/API/ProbeAPI.test.ts @@ -27,7 +27,7 @@ jest.mock('../../Utils/Response', () => { sendJsonObjectResponse: jest.fn().mockImplementation((...args: []) => { return args; }), - sendEmptyResponse: jest.fn(), + sendEmptySuccessResponse: jest.fn(), sendEntityResponse: jest.fn().mockImplementation((...args: []) => { return args; }), diff --git a/CommonServer/Tests/API/ProjectAPI.test.ts b/CommonServer/Tests/API/ProjectAPI.test.ts index 99f808cce0..6a3830bb40 100644 --- a/CommonServer/Tests/API/ProjectAPI.test.ts +++ b/CommonServer/Tests/API/ProjectAPI.test.ts @@ -31,7 +31,7 @@ jest.mock('../../Utils/Response', () => { sendJsonObjectResponse: jest.fn().mockImplementation((...args: []) => { return args; }), - sendEmptyResponse: jest.fn(), + sendEmptySuccessResponse: jest.fn(), sendEntityResponse: jest.fn().mockImplementation((...args: []) => { return args; }), diff --git a/CommonServer/Tests/API/UserSmsApi.test.ts b/CommonServer/Tests/API/UserSmsApi.test.ts index a1493e7910..32ae5694ec 100644 --- a/CommonServer/Tests/API/UserSmsApi.test.ts +++ b/CommonServer/Tests/API/UserSmsApi.test.ts @@ -28,7 +28,7 @@ jest.mock('../../Utils/Response', () => { sendJsonObjectResponse: jest.fn().mockImplementation((...args: []) => { return args; }), - sendEmptyResponse: jest.fn(), + sendEmptySuccessResponse: jest.fn(), sendEntityResponse: jest.fn().mockImplementation((...args: []) => { return args; }), @@ -220,7 +220,7 @@ describe('UserSmsAPI', () => { const response: jest.SpyInstance = jest.spyOn( Response, - 'sendEmptyResponse' + 'sendEmptySuccessResponse' ); expect(response).toHaveBeenCalledWith(mockRequest, mockResponse); }); @@ -269,7 +269,7 @@ describe('UserSmsAPI', () => { const response: jest.SpyInstance = jest.spyOn( Response, - 'sendEmptyResponse' + 'sendEmptySuccessResponse' ); expect(response).toHaveBeenCalledWith(mockRequest, mockResponse); }); diff --git a/CommonServer/Utils/Response.ts b/CommonServer/Utils/Response.ts index 2e8c9bc1de..ee8cda6c14 100644 --- a/CommonServer/Utils/Response.ts +++ b/CommonServer/Utils/Response.ts @@ -22,7 +22,7 @@ import AnalyticsDataModel, { } from 'Common/AnalyticsModels/BaseModel'; export default class Response { - public static sendEmptyResponse( + public static sendEmptySuccessResponse( _req: ExpressRequest, res: ExpressResponse ): void { diff --git a/Ingestor/API/Alive.ts b/Ingestor/API/Alive.ts index cdb12d98cc..4622c9de98 100644 --- a/Ingestor/API/Alive.ts +++ b/Ingestor/API/Alive.ts @@ -20,7 +20,7 @@ router.post( try { // middleware marks the probe as alive. // so we don't need to do anything here. - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/Ingestor/API/FluentIngest.ts b/Ingestor/API/FluentIngest.ts index 983875a85b..e43558029d 100644 --- a/Ingestor/API/FluentIngest.ts +++ b/Ingestor/API/FluentIngest.ts @@ -79,7 +79,7 @@ router.post( }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/Ingestor/API/IncomingRequest.ts b/Ingestor/API/IncomingRequest.ts index 3268564a64..58a10240da 100644 --- a/Ingestor/API/IncomingRequest.ts +++ b/Ingestor/API/IncomingRequest.ts @@ -68,7 +68,7 @@ const processIncomingRequest: RequestHandler = async ( // process probe response here. await ProbeMonitorResponseService.processProbeResponse(incomingRequest); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/Ingestor/API/OTelIngest.ts b/Ingestor/API/OTelIngest.ts index 36b6e1bc47..21849d52f7 100644 --- a/Ingestor/API/OTelIngest.ts +++ b/Ingestor/API/OTelIngest.ts @@ -271,7 +271,7 @@ router.post( }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } @@ -523,7 +523,7 @@ router.post( }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } @@ -695,7 +695,7 @@ router.post( }, }); - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/Ingestor/API/ServerMonitor.ts b/Ingestor/API/ServerMonitor.ts index f59068a448..0d0d7f0629 100644 --- a/Ingestor/API/ServerMonitor.ts +++ b/Ingestor/API/ServerMonitor.ts @@ -53,7 +53,7 @@ router.get( throw new BadDataException('Monitor not found'); } - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); } diff --git a/TestServer/API/Settings.ts b/TestServer/API/Settings.ts index 5dd22cebc2..6c1a391d01 100644 --- a/TestServer/API/Settings.ts +++ b/TestServer/API/Settings.ts @@ -65,7 +65,7 @@ router.post( // middleware marks the probe as alive. // so we don't need to do anything here. - return Response.sendEmptyResponse(req, res); + return Response.sendEmptySuccessResponse(req, res); } catch (err) { return next(err); }