Replace variable declarations with destructuring

This commit is contained in:
dongfang committed 2025-02-12 02:52:35 +00:00
1 parent b7a8596b7b
commit 81a0ec8b23
1 file changed
+5 -6
+5 -6
View File
@@ -122,20 +122,19 @@ class NetworkService {
*/ */
async requestHttp(job) { async requestHttp(job) {
try { try {
const url = job.data.url; const { url, secret, _id, teamId, type, jsonPath, matchMethod, expectedValue } = job.data;
const config = {}; const config = {};
job.data.secret !== undefined && secret !== undefined && (config.headers = { Authorization: `Bearer ${secret}` });
(config.headers = { Authorization: `Bearer ${job.data.secret}` });
const { response, responseTime, error } = await this.timeRequest(() => const { response, responseTime, error } = await this.timeRequest(() =>
this.axios.get(url, config) this.axios.get(url, config)
); );
const httpResponse = { const httpResponse = {
monitorId: job.data._id, monitorId: _id,
teamId: job.data.teamId, teamId,
type: job.data.type, type,
responseTime, responseTime,
payload: response?.data, payload: response?.data,
}; };