@itentialopensource/adapter-utils 4.48.0 → 4.48.1
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.
- package/CHANGELOG.md +10 -0
- package/lib/connectorRest.js +80 -58
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
## 4.48.1 [09-22-2022]
|
|
3
|
+
|
|
4
|
+
* Add capability to send base64 and buffer in formData
|
|
5
|
+
|
|
6
|
+
Closes ADAPT-2380
|
|
7
|
+
|
|
8
|
+
See merge request itentialopensource/adapter-utils!238
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
2
12
|
## 4.48.0 [08-16-2022]
|
|
3
13
|
|
|
4
14
|
* Changes to support entitypath object with multiple paths
|
package/lib/connectorRest.js
CHANGED
|
@@ -255,11 +255,11 @@ function matchMock(uriPath, method, type, mockresponses, respDatatype) {
|
|
|
255
255
|
for (let p = 0; p < mockresponses.length; p += 1) {
|
|
256
256
|
// is this the mock data for this call
|
|
257
257
|
if (Object.hasOwnProperty.call(mockresponses[p], 'name')
|
|
258
|
-
|
|
258
|
+
&& uriPath === mockresponses[p].name) {
|
|
259
259
|
if (Object.hasOwnProperty.call(mockresponses[p], 'method')
|
|
260
|
-
|
|
260
|
+
&& method.toUpperCase() === mockresponses[p].method.toUpperCase()) {
|
|
261
261
|
if (Object.hasOwnProperty.call(mockresponses[p], 'type')
|
|
262
|
-
|
|
262
|
+
&& type.toUpperCase() === mockresponses[p].type.toUpperCase()) {
|
|
263
263
|
// This is the mock data we really want as it best matches the request
|
|
264
264
|
const specificResp = {
|
|
265
265
|
status: 'success',
|
|
@@ -270,7 +270,7 @@ function matchMock(uriPath, method, type, mockresponses, respDatatype) {
|
|
|
270
270
|
if (Object.hasOwnProperty.call(mockresponses[p], 'response')) {
|
|
271
271
|
// if a status is defined in the response, use it
|
|
272
272
|
if (Object.hasOwnProperty.call(mockresponses[p].response, 'response')
|
|
273
|
-
|
|
273
|
+
&& Object.hasOwnProperty.call(mockresponses[p].response, 'status')) {
|
|
274
274
|
specificResp.code = mockresponses[p].response.status;
|
|
275
275
|
|
|
276
276
|
if (respDatatype && respDatatype.toUpperCase() === 'XML2JSON') {
|
|
@@ -396,7 +396,7 @@ function returnStub(request, entitySchema, callProperties) {
|
|
|
396
396
|
|
|
397
397
|
// if there is a request body, see if there is something that matches a specific input
|
|
398
398
|
if (reqBody && (!entitySchema || !entitySchema.requestDatatype
|
|
399
|
-
|
|
399
|
+
|| entitySchema.requestDatatype.toUpperCase() === 'JSON' || entitySchema.requestDatatype.toUpperCase() === 'URLENCODE')) {
|
|
400
400
|
let reqBdObj = null;
|
|
401
401
|
if (entitySchema && entitySchema.requestDatatype && entitySchema.requestDatatype.toUpperCase() === 'URLENCODE') {
|
|
402
402
|
reqBdObj = querystring.parse(reqBody.trim());
|
|
@@ -661,38 +661,60 @@ function makeRequest(request, entitySchema, callProperties, startTrip, attempt,
|
|
|
661
661
|
}
|
|
662
662
|
// add the data for each field into the form
|
|
663
663
|
const mykeys = Object.keys(mybody);
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
664
|
+
if (mykeys.length === 2 && mykeys[0] === 'file' && mykeys[1] === 'convertBase64ToBuffer') {
|
|
665
|
+
const filePart = mybody[mykeys[0]].split(';');
|
|
666
|
+
let fileName = null;
|
|
667
|
+
// see if we have a filename that we should add to the formdata
|
|
668
|
+
for (let p = 1; p < filePart.length; p += 1) {
|
|
669
|
+
if (filePart[p].indexOf('name=') === 0) {
|
|
670
|
+
fileName = filePart[p].substring(5);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if (mybody.convertBase64ToBuffer === true) {
|
|
674
|
+
let fileBuffer = filePart[filePart.length - 1];
|
|
675
|
+
if (filePart[filePart.length - 1].startsWith('base64')) {
|
|
676
|
+
fileBuffer = Buffer.from(filePart[filePart.length - 1].substring(7), 'base64');
|
|
677
|
+
}
|
|
678
|
+
log.debug(`APPENDING: ${mykeys[0]}, WITH VALUE ${fileBuffer}, AND NAME ${fileName}`);
|
|
679
|
+
formData.append(mykeys[0], fileBuffer, fileName);
|
|
680
|
+
} else {
|
|
681
|
+
log.debug(`APPENDING: ${mykeys[0]}, WITH VALUE ${filePart[filePart.length - 1]}, AND NAME ${fileName}`);
|
|
682
|
+
formData.append(mykeys[0], filePart[filePart.length - 1], fileName);
|
|
683
|
+
}
|
|
684
|
+
} else {
|
|
685
|
+
for (let k = 0; k < mykeys.length; k += 1) {
|
|
686
|
+
if (mykeys[k] === 'file') {
|
|
687
|
+
let fileVal = mybody[mykeys[k]];
|
|
688
|
+
if (fileVal.indexOf('@') === 0) {
|
|
689
|
+
// if there are multiple parts - first part is file, other part can be name
|
|
690
|
+
const filePart = fileVal.split(';');
|
|
691
|
+
let fileName = null;
|
|
692
|
+
fileVal = fs.readFileSync(`node_modules/@itentialopensource/adapter-forwardnetworks/uploads/${filePart[0].substring(1)}`);
|
|
693
|
+
|
|
694
|
+
// see if we have a filename that we should add to the formdata
|
|
695
|
+
for (let p = 1; p < filePart.length; p += 1) {
|
|
696
|
+
if (filePart[p].indexOf('name=') === 0) {
|
|
697
|
+
fileName = filePart[p].substring(5);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
if (fileName) {
|
|
701
|
+
// with filename
|
|
702
|
+
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${fileVal}, AND NAME ${fileName}`);
|
|
703
|
+
formData.append(mykeys[k], fileVal, fileName);
|
|
704
|
+
} else {
|
|
705
|
+
// with read in file but no file name
|
|
706
|
+
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${fileVal}`);
|
|
707
|
+
formData.append(mykeys[k], fileVal);
|
|
677
708
|
}
|
|
678
|
-
}
|
|
679
|
-
if (fileName) {
|
|
680
|
-
// with filename
|
|
681
|
-
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${fileVal}, AND NAME ${fileName}`);
|
|
682
|
-
formData.append(mykeys[k], fileVal, fileName);
|
|
683
709
|
} else {
|
|
684
|
-
//
|
|
710
|
+
// no file or file name just contents - original
|
|
685
711
|
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${fileVal}`);
|
|
686
712
|
formData.append(mykeys[k], fileVal);
|
|
687
713
|
}
|
|
688
714
|
} else {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
formData.append(mykeys[k], fileVal);
|
|
715
|
+
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${mybody[mykeys[k]]}`);
|
|
716
|
+
formData.append(mykeys[k], mybody[mykeys[k]]);
|
|
692
717
|
}
|
|
693
|
-
} else {
|
|
694
|
-
log.debug(`APPENDING: ${mykeys[k]}, WITH VALUE ${mybody[mykeys[k]]}`);
|
|
695
|
-
formData.append(mykeys[k], mybody[mykeys[k]]);
|
|
696
718
|
}
|
|
697
719
|
}
|
|
698
720
|
// get the new headers
|
|
@@ -888,7 +910,7 @@ function makeRequest(request, entitySchema, callProperties, startTrip, attempt,
|
|
|
888
910
|
|
|
889
911
|
// write to the http request data to the body if not a get (gets do not have data in the body)
|
|
890
912
|
if ((request.header.method !== 'GET' || entitySchema.sendGetBody)
|
|
891
|
-
|
|
913
|
+
&& ((typeof request.body === 'object' && Object.keys(request.body).length > 0)
|
|
892
914
|
|| (typeof request.body === 'string' && request.body !== '{}') || entitySchema.sendEmpty)) {
|
|
893
915
|
if (entitySchema.requestDatatype.toUpperCase() === 'FORM') {
|
|
894
916
|
// pass the formData to the request
|
|
@@ -1205,7 +1227,7 @@ function getToken(reqPath, options, tokenSchema, bodyString, callProperties, cal
|
|
|
1205
1227
|
|
|
1206
1228
|
// process primary token from header
|
|
1207
1229
|
if (tokenSchema.responseSchema && tokenSchema.responseSchema.properties && tokenSchema.responseSchema.properties.token
|
|
1208
|
-
|
|
1230
|
+
&& tokenSchema.responseSchema.properties.token.placement && tokenSchema.responseSchema.properties.token.placement.toUpperCase() === 'HEADER') {
|
|
1209
1231
|
if (!tokenSchema.responseSchema.properties.token.external_name) {
|
|
1210
1232
|
const errorObj = transUtilInst.formatErrorObject(origin, 'Unable To Get Primary Token', ['Primary Token', result.code], null, null, null);
|
|
1211
1233
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
@@ -1794,7 +1816,7 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1794
1816
|
|
|
1795
1817
|
// only add global options if there are global options to add
|
|
1796
1818
|
if (globalRequest && globalRequest.uriOptions
|
|
1797
|
-
|
|
1819
|
+
&& Object.keys(globalRequest.uriOptions).length > 0) {
|
|
1798
1820
|
const optionString = querystring.stringify(globalRequest.uriOptions);
|
|
1799
1821
|
|
|
1800
1822
|
// if no query paramters yet - start with ?
|
|
@@ -2106,7 +2128,7 @@ function validToken(user, reqBody, invalidToken, callback) {
|
|
|
2106
2128
|
// if the token expired (or will expire within a minute),
|
|
2107
2129
|
// or it is invalid (failed) remove it from the token list
|
|
2108
2130
|
if (tokenList[i].expire < expireCheck
|
|
2109
|
-
|
|
2131
|
+
|| tokenList[i].token.token === invalidToken) {
|
|
2110
2132
|
tokenList.splice(i, 1);
|
|
2111
2133
|
break;
|
|
2112
2134
|
}
|
|
@@ -2820,7 +2842,7 @@ function handleEndThrottleResponse(request, myTransTime, claimedLic, makeResp, r
|
|
|
2820
2842
|
|
|
2821
2843
|
// If the request was successful
|
|
2822
2844
|
if (makeResp !== null && makeResp.code !== undefined
|
|
2823
|
-
|
|
2845
|
+
&& Number(makeResp.code) >= 200 && Number(makeResp.code) <= 299) {
|
|
2824
2846
|
const newResp = {
|
|
2825
2847
|
icode: `AD.${makeResp.code}`,
|
|
2826
2848
|
response: makeResp.response,
|
|
@@ -2919,7 +2941,7 @@ function retryInvalidResponse(request, callProperties, myTransTime, claimedLic,
|
|
|
2919
2941
|
let retries = numRetries;
|
|
2920
2942
|
if (callProperties && callProperties.request && callProperties.request.limit_retry_error) {
|
|
2921
2943
|
if (typeof callProperties.request.limit_retry_error === 'number'
|
|
2922
|
-
|
|
2944
|
+
|| typeof callProperties.request.limit_retry_error === 'string') {
|
|
2923
2945
|
retryError = [Number(callProperties.request.limit_retry_error)];
|
|
2924
2946
|
} else if (Array.isArray(callProperties.request.limit_retry_error)) {
|
|
2925
2947
|
retryError = [];
|
|
@@ -2927,10 +2949,10 @@ function retryInvalidResponse(request, callProperties, myTransTime, claimedLic,
|
|
|
2927
2949
|
if (typeof callProperties.request.limit_retry_error[l] === 'number') {
|
|
2928
2950
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
2929
2951
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
2930
|
-
|
|
2952
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') < 0) {
|
|
2931
2953
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
2932
2954
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
2933
|
-
|
|
2955
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') >= 0) {
|
|
2934
2956
|
const srange = Number(callProperties.request.limit_retry_error[l].split('-')[0]);
|
|
2935
2957
|
const erange = Number(callProperties.request.limit_retry_error[l].split('-')[1]);
|
|
2936
2958
|
for (let r = srange; r <= erange; r += 1) {
|
|
@@ -2947,7 +2969,7 @@ function retryInvalidResponse(request, callProperties, myTransTime, claimedLic,
|
|
|
2947
2969
|
// if the response is valid - good data or legitimate data error
|
|
2948
2970
|
// stop trying if we have tried enough
|
|
2949
2971
|
if (numTries > retries || (mres !== null && mres.code !== undefined && !retryError.includes(Number(mres.code))
|
|
2950
|
-
|
|
2972
|
+
&& (authMethod !== 'request_token' || Number(mres.code) !== Number(tokenError)))) {
|
|
2951
2973
|
const newresp = mres;
|
|
2952
2974
|
newresp.retries = numTries;
|
|
2953
2975
|
|
|
@@ -3083,7 +3105,7 @@ function noQueueRequest(request, callProperties, overallTime, entitySchema, call
|
|
|
3083
3105
|
let retries = numRetries;
|
|
3084
3106
|
if (callProperties && callProperties.request && callProperties.request.limit_retry_error) {
|
|
3085
3107
|
if (typeof callProperties.request.limit_retry_error === 'number'
|
|
3086
|
-
|
|
3108
|
+
|| typeof callProperties.request.limit_retry_error === 'string') {
|
|
3087
3109
|
retryError = [Number(callProperties.request.limit_retry_error)];
|
|
3088
3110
|
} else if (Array.isArray(callProperties.request.limit_retry_error)) {
|
|
3089
3111
|
retryError = [];
|
|
@@ -3091,10 +3113,10 @@ function noQueueRequest(request, callProperties, overallTime, entitySchema, call
|
|
|
3091
3113
|
if (typeof callProperties.request.limit_retry_error[l] === 'number') {
|
|
3092
3114
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
3093
3115
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
3094
|
-
|
|
3116
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') < 0) {
|
|
3095
3117
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
3096
3118
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
3097
|
-
|
|
3119
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') >= 0) {
|
|
3098
3120
|
const srange = Number(callProperties.request.limit_retry_error[l].split('-')[0]);
|
|
3099
3121
|
const erange = Number(callProperties.request.limit_retry_error[l].split('-')[1]);
|
|
3100
3122
|
for (let r = srange; r <= erange; r += 1) {
|
|
@@ -3110,14 +3132,14 @@ function noQueueRequest(request, callProperties, overallTime, entitySchema, call
|
|
|
3110
3132
|
|
|
3111
3133
|
// if invalid token, handle that and retry
|
|
3112
3134
|
if (mres !== null && mres.code !== undefined && Number(mres.code) === Number(tokenError)
|
|
3113
|
-
|
|
3135
|
+
&& authMethod === 'request_token') {
|
|
3114
3136
|
// if we took an invalid token - try one more time
|
|
3115
3137
|
return handleInvalidToken(request, callProperties, 0, { request_id: 0 }, mres, overallTime, overallTime, 0, 1, entitySchema, callback);
|
|
3116
3138
|
}
|
|
3117
3139
|
|
|
3118
3140
|
// if the response is valid - good data or legitimate data error
|
|
3119
3141
|
if (retries < 1 || (mres !== null && mres.code !== undefined && !retryError.includes(Number(mres.code))
|
|
3120
|
-
|
|
3142
|
+
&& (authMethod !== 'request_token' || Number(mres.code) !== Number(tokenError)))) {
|
|
3121
3143
|
return handleEndResponse(request, mres, overallTime, callback);
|
|
3122
3144
|
}
|
|
3123
3145
|
|
|
@@ -3182,7 +3204,7 @@ function queueThrottleRequest(request, callProperties, myRequestId, myTransTime,
|
|
|
3182
3204
|
let retries = numRetries;
|
|
3183
3205
|
if (callProperties && callProperties.request && callProperties.request.limit_retry_error) {
|
|
3184
3206
|
if (typeof callProperties.request.limit_retry_error === 'number'
|
|
3185
|
-
|
|
3207
|
+
|| typeof callProperties.request.limit_retry_error === 'string') {
|
|
3186
3208
|
retryError = [Number(callProperties.request.limit_retry_error)];
|
|
3187
3209
|
} else if (Array.isArray(callProperties.request.limit_retry_error)) {
|
|
3188
3210
|
retryError = [];
|
|
@@ -3190,10 +3212,10 @@ function queueThrottleRequest(request, callProperties, myRequestId, myTransTime,
|
|
|
3190
3212
|
if (typeof callProperties.request.limit_retry_error[l] === 'number') {
|
|
3191
3213
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
3192
3214
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
3193
|
-
|
|
3215
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') < 0) {
|
|
3194
3216
|
retryError.push(Number(callProperties.request.limit_retry_error[l]));
|
|
3195
3217
|
} else if (typeof callProperties.request.limit_retry_error[l] === 'string'
|
|
3196
|
-
|
|
3218
|
+
&& callProperties.request.limit_retry_error[l].indexOf('-') >= 0) {
|
|
3197
3219
|
const srange = Number(callProperties.request.limit_retry_error[l].split('-')[0]);
|
|
3198
3220
|
const erange = Number(callProperties.request.limit_retry_error[l].split('-')[1]);
|
|
3199
3221
|
for (let r = srange; r <= erange; r += 1) {
|
|
@@ -3209,14 +3231,14 @@ function queueThrottleRequest(request, callProperties, myRequestId, myTransTime,
|
|
|
3209
3231
|
|
|
3210
3232
|
// if invalid token, handle that and retry
|
|
3211
3233
|
if (mres !== null && mres.code !== undefined && Number(mres.code) === Number(tokenError)
|
|
3212
|
-
|
|
3234
|
+
&& authMethod === 'request_token') {
|
|
3213
3235
|
// if we took an invalid token - try one more time
|
|
3214
3236
|
return handleInvalidToken(request, callProperties, myTransTime, claimedLic, mres, reqTime, overallTime, waitEnd, 1, entitySchema, callback);
|
|
3215
3237
|
}
|
|
3216
3238
|
|
|
3217
3239
|
// if the response is valid - good data or legitimate data error
|
|
3218
3240
|
if (retries < 1 || (mres !== null && mres.code !== undefined && !retryError.includes(Number(mres.code))
|
|
3219
|
-
|
|
3241
|
+
&& (authMethod !== 'request_token' || Number(mres.code) !== Number(tokenError)))) {
|
|
3220
3242
|
return handleEndThrottleResponse(request, myTransTime, claimedLic, mres, reqTime, overallTime, waitEnd, callback);
|
|
3221
3243
|
}
|
|
3222
3244
|
|
|
@@ -3366,13 +3388,13 @@ class ConnectorRest {
|
|
|
3366
3388
|
|
|
3367
3389
|
// set the invalid token error (optional - default is null)
|
|
3368
3390
|
if (typeof props.authentication.invalid_token_error === 'number'
|
|
3369
|
-
|
|
3391
|
+
|| typeof props.authentication.invalid_token_error === 'string') {
|
|
3370
3392
|
tokenError = Number(props.authentication.invalid_token_error);
|
|
3371
3393
|
}
|
|
3372
3394
|
|
|
3373
3395
|
// set the token timeout (optional - default is null)
|
|
3374
3396
|
if (typeof props.authentication.token_timeout === 'number'
|
|
3375
|
-
|
|
3397
|
+
|| typeof props.authentication.token_timeout === 'string') {
|
|
3376
3398
|
tokenTimeout = Number(props.authentication.token_timeout);
|
|
3377
3399
|
}
|
|
3378
3400
|
|
|
@@ -3453,19 +3475,19 @@ class ConnectorRest {
|
|
|
3453
3475
|
if (props.request) {
|
|
3454
3476
|
// set the number of redirects (optional - default is 0)
|
|
3455
3477
|
if (typeof props.request.number_redirects === 'number'
|
|
3456
|
-
|
|
3478
|
+
|| typeof props.request.number_redirects === 'string') {
|
|
3457
3479
|
numRedirects = Number(props.request.number_redirects);
|
|
3458
3480
|
}
|
|
3459
3481
|
|
|
3460
3482
|
// set the number of retries (optional - default is 3)
|
|
3461
3483
|
if (typeof props.request.number_retries === 'number'
|
|
3462
|
-
|
|
3484
|
+
|| typeof props.request.number_retries === 'string') {
|
|
3463
3485
|
numRetries = Number(props.request.number_retries);
|
|
3464
3486
|
}
|
|
3465
3487
|
|
|
3466
3488
|
// set the request retry error (optional - default is 0)
|
|
3467
3489
|
if (typeof props.request.limit_retry_error === 'number'
|
|
3468
|
-
|
|
3490
|
+
|| typeof props.request.limit_retry_error === 'string') {
|
|
3469
3491
|
limitRetryError = [Number(props.request.limit_retry_error)];
|
|
3470
3492
|
} else if (Array.isArray(props.request.limit_retry_error)) {
|
|
3471
3493
|
limitRetryError = [];
|
|
@@ -3473,10 +3495,10 @@ class ConnectorRest {
|
|
|
3473
3495
|
if (typeof props.request.limit_retry_error[l] === 'number') {
|
|
3474
3496
|
limitRetryError.push(Number(props.request.limit_retry_error[l]));
|
|
3475
3497
|
} else if (typeof props.request.limit_retry_error[l] === 'string'
|
|
3476
|
-
|
|
3498
|
+
&& props.request.limit_retry_error[l].indexOf('-') < 0) {
|
|
3477
3499
|
limitRetryError.push(Number(props.request.limit_retry_error[l]));
|
|
3478
3500
|
} else if (typeof props.request.limit_retry_error[l] === 'string'
|
|
3479
|
-
|
|
3501
|
+
&& props.request.limit_retry_error[l].indexOf('-') >= 0) {
|
|
3480
3502
|
const srange = Number(props.request.limit_retry_error[l].split('-')[0]);
|
|
3481
3503
|
const erange = Number(props.request.limit_retry_error[l].split('-')[1]);
|
|
3482
3504
|
for (let r = srange; r <= erange; r += 1) {
|
|
@@ -3488,7 +3510,7 @@ class ConnectorRest {
|
|
|
3488
3510
|
|
|
3489
3511
|
// set the request attempt timeout (optional - default is 5000)
|
|
3490
3512
|
if (typeof props.request.attempt_timeout === 'number'
|
|
3491
|
-
|
|
3513
|
+
|| typeof props.request.attempt_timeout === 'string') {
|
|
3492
3514
|
attemptTimeout = Number(props.request.attempt_timeout);
|
|
3493
3515
|
}
|
|
3494
3516
|
|
|
@@ -3910,7 +3932,7 @@ class ConnectorRest {
|
|
|
3910
3932
|
}
|
|
3911
3933
|
|
|
3912
3934
|
if (pres !== null && pres.code !== undefined
|
|
3913
|
-
|
|
3935
|
+
&& (Number(pres.code) < 200 || Number(pres.code) > 299)) {
|
|
3914
3936
|
let errorObj = null;
|
|
3915
3937
|
|
|
3916
3938
|
if (pres.code === -2) {
|