From a0866a5b881d18cbb3b3cf8de82039fdee9efcf4 Mon Sep 17 00:00:00 2001 From: Yugal Sharma <131900120+yusharma-pp@users.noreply.github.com> Date: Mon, 12 May 2025 14:02:20 +0530 Subject: [PATCH 1/3] Update CHANGELOG --- CHANGELOG | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 98c19f8..638f0e6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -45,4 +45,8 @@ - Surface error types 6.0.0 Sept, 2023 - - Force all requests to go through HTTPS \ No newline at end of file + - Force all requests to go through HTTPS + +7.0.0 Map, 2025 + - Added Node 22 support + - Improved Disputes PUT request socket handling From e553101064835267d05df553f4aa609d3b321e3a Mon Sep 17 00:00:00 2001 From: Yugal Sharma <131900120+yusharma-pp@users.noreply.github.com> Date: Mon, 12 May 2025 14:03:10 +0530 Subject: [PATCH 2/3] Update api-requestor.js --- lib/api-requestor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/api-requestor.js b/lib/api-requestor.js index 8e281ec..d007038 100644 --- a/lib/api-requestor.js +++ b/lib/api-requestor.js @@ -58,7 +58,8 @@ module.exports = class ApiRequestor { path: requestUrl.pathname + requestUrl.search, method: spec.method.toUpperCase(), headers: this.getHeaders(!!spec.data), - auth: `${this.getApiKey()}:` + auth: `${this.getApiKey()}:`, + rejectUnauthorized: true } if (this._chargehound.options.port) { @@ -66,7 +67,6 @@ module.exports = class ApiRequestor { } const req = https.request(reqOpts).setTimeout(this.getTimeout()) - const connectEv = 'secureConnect' req.on('timeout', function () { req.abort() @@ -77,7 +77,7 @@ module.exports = class ApiRequestor { }) req.on('socket', function (socket) { - socket.on(connectEv, function () { + socket.on('connect', function () { if (spec.data) { req.write(JSON.stringify(spec.data)) } @@ -85,6 +85,12 @@ module.exports = class ApiRequestor { }) }) + // Ensure the request is sent even if the event is not triggered + if (spec.data) { + req.write(JSON.stringify(spec.data)) + } + req.end() + req.on('response', function (res) { let response = '' From c08d4050565958ad03e3235bb3fc1e1cafba6157 Mon Sep 17 00:00:00 2001 From: Yugal Sharma <131900120+yusharma-pp@users.noreply.github.com> Date: Mon, 12 May 2025 14:03:44 +0530 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4362e1..235c41e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chargehound", - "version": "6.0.0", + "version": "7.0.0", "description": "Automatically fight disputes", "main": "lib/index.js", "engines": {