Removed timing request for the webhook.

This commit is contained in:
Skorpios committed 2025-02-16 20:28:34 -08:00
1 parent 55c1a1c233
commit ff2b3b4e10
1 file changed
+15 -21
+15 -21
View File
@@ -437,24 +437,21 @@ class NetworkService {
async requestWebhook(platform, url, message) { async requestWebhook(platform, url, message) {
try { try {
const { response, responseTime, error } = await this.timeRequest(() => const response = await this.axios.post(url, message, {
this.axios.post(url, message, {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}) });
);
const webhookResponse = { return {
type: 'webhook', type: 'webhook',
responseTime, status: true,
payload: response?.data code: response.status,
message: `Successfully sent ${platform} notification`,
payload: response.data
}; };
if (error) { } catch (error) {
webhookResponse.status = false;
webhookResponse.code = error.response?.status || this.NETWORK_ERROR;
webhookResponse.message = `Failed to send ${platform} notification`;
this.logger.warn({ this.logger.warn({
message: error.message, message: error.message,
service: this.SERVICE_NAME, service: this.SERVICE_NAME,
@@ -466,17 +463,14 @@ class NetworkService {
responseData: error.response?.data, responseData: error.response?.data,
requestPayload: message requestPayload: message
}); });
return webhookResponse;
}
webhookResponse.status = true; return {
webhookResponse.code = response.status; type: 'webhook',
webhookResponse.message = `Successfully sent ${platform} notification`; status: false,
return webhookResponse; code: error.response?.status || this.NETWORK_ERROR,
} catch (error) { message: `Failed to send ${platform} notification`,
error.service = this.SERVICE_NAME; payload: error.response?.data
error.method = 'requestWebhook'; };
throw error;
} }
} }