rubik-pact 1.0.4 → 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.
- package/classes/Pact.js +5 -5
- package/package.json +1 -1
package/classes/Pact.js
CHANGED
|
@@ -66,13 +66,13 @@ class Pact extends Kubik {
|
|
|
66
66
|
* @param {String} [host=this.host] хост API Viber
|
|
67
67
|
* @return {Promise<Object>} ответ от Pact API
|
|
68
68
|
*/
|
|
69
|
-
async request({ path, body, params, token, host }) {
|
|
70
|
-
const url = this.getUrl({ path, params, host });
|
|
69
|
+
async request({ path, body, params, token, host, method, queryParams }) {
|
|
70
|
+
const url = this.getUrl({ path, params, host, queryParams});
|
|
71
71
|
|
|
72
72
|
if (!token) token = this.token;
|
|
73
73
|
const headers = { 'X-Private-Api-Token': token };
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
method = method || 'POST';
|
|
76
76
|
if (body instanceof FormData) {
|
|
77
77
|
Object.assign(headers, body.getHeaders());
|
|
78
78
|
} else if (isObject(body)) {
|
|
@@ -105,8 +105,8 @@ class Pact extends Kubik {
|
|
|
105
105
|
generateMethod({ kubikName, apiName }) {
|
|
106
106
|
const method = (options) => {
|
|
107
107
|
if (!options) options = {};
|
|
108
|
-
const { params, body, token, host } = options;
|
|
109
|
-
return this.request({ path: apiName, body, params, token, host });
|
|
108
|
+
const { params, body, token, host, queryParams, method } = options;
|
|
109
|
+
return this.request({ path: apiName, body, params, token, host, queryParams, method });
|
|
110
110
|
};
|
|
111
111
|
set(this, kubikName, method);
|
|
112
112
|
}
|