@vouchfor/sdk 1.0.5 → 1.0.6
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.
|
@@ -13,6 +13,7 @@ class BaseService {
|
|
|
13
13
|
async _callApi({
|
|
14
14
|
apiKey = '',
|
|
15
15
|
integrationKey = '',
|
|
16
|
+
method,
|
|
16
17
|
body,
|
|
17
18
|
url,
|
|
18
19
|
}) {
|
|
@@ -26,7 +27,12 @@ class BaseService {
|
|
|
26
27
|
headers['x-integration-key'] = integrationKey;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
return utils.request({
|
|
30
|
+
return utils.request({
|
|
31
|
+
body,
|
|
32
|
+
headers,
|
|
33
|
+
method,
|
|
34
|
+
url,
|
|
35
|
+
});
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
|
|
@@ -11,10 +11,11 @@ class BaseIntegrationService extends BaseService {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
_request({ body, path }) {
|
|
14
|
+
_request({ body, method, path }) {
|
|
15
15
|
return this._callApi({
|
|
16
16
|
apiKey: this._apiKey,
|
|
17
17
|
body,
|
|
18
|
+
method,
|
|
18
19
|
url: `${this._baseUrl}/${path}`,
|
|
19
20
|
});
|
|
20
21
|
}
|
|
@@ -12,11 +12,12 @@ class BaseRestService extends BaseService {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
_request({ apiKey, body, path }) {
|
|
15
|
+
_request({ apiKey, body, method, path }) {
|
|
16
16
|
return this._callApi({
|
|
17
17
|
apiKey: apiKey || this._apiKey,
|
|
18
18
|
integrationKey: this._integrationKey,
|
|
19
19
|
body,
|
|
20
|
+
method,
|
|
20
21
|
url: `${this._baseUrl}/${path}`,
|
|
21
22
|
});
|
|
22
23
|
}
|
package/lib/shared/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
const isProd = env === 'prod';
|
|
6
6
|
return isProd ? '' : `-${env}`;
|
|
7
7
|
},
|
|
8
|
-
request({ body, headers, url }) {
|
|
8
|
+
request({ body, headers, method, url }) {
|
|
9
9
|
const { host, pathname, search = '' } = new URL(url);
|
|
10
10
|
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
|
15
15
|
host,
|
|
16
16
|
path: `${pathname}${search}`,
|
|
17
17
|
headers,
|
|
18
|
-
method: body ? 'POST' : 'GET',
|
|
18
|
+
method: method ? method : body ? 'POST' : 'GET',
|
|
19
19
|
},
|
|
20
20
|
(res) => {
|
|
21
21
|
res.on('data', (chunk) => {
|