@itentialopensource/adapter-utils 6.1.9 → 6.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -913,11 +913,12 @@ function makeRequest(request, entitySchema, callProperties, startTrip, attempt,
913
913
  };
914
914
  let didTimeout = 0;
915
915
 
916
- // if the connection was reset - need to determine if client or server cut it
917
- if (cerror.code === 'ECONNRESET') {
916
+ if (cerror.code === 'ETIMEDOUT') {
917
+ callResp.code = -2;
918
+ didTimeout += 1;
919
+ } else if (cerror.code === 'ECONNRESET') {
920
+ // Connection reset - check if it was our timeout
918
921
  const endTime = new Date().getTime();
919
-
920
- // see if this is a client timeout
921
922
  if (endTime - stTime >= myTimeout) {
922
923
  callResp.code = -2;
923
924
  didTimeout += 1;
@@ -938,8 +939,10 @@ function makeRequest(request, entitySchema, callProperties, startTrip, attempt,
938
939
  });
939
940
 
940
941
  httpRequest.setTimeout(myTimeout, () => {
941
- httpRequest.abort();
942
- }, myTimeout);
942
+ const timeoutError = new Error('Request timeout');
943
+ timeoutError.code = 'ETIMEDOUT';
944
+ httpRequest.destroy(timeoutError);
945
+ });
943
946
 
944
947
  // write to the http request data to the body if not a get (gets do not have data in the body)
945
948
  if ((request.header.method !== 'GET' || entitySchema.sendGetBody)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "6.1.9",
3
+ "version": "6.1.11",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",