@weapnl/js-junction 0.0.8 → 0.0.9
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 +5 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/api.js +1 -1
- package/src/connection.js +4 -0
- package/src/request.js +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## v0.0.9
|
|
6
|
+
- Added option to override the config of an request.
|
|
7
|
+
- Added the body parameters to the post request.
|
|
8
|
+
- Updated the requests variable from a object to an array.
|
|
9
|
+
|
|
5
10
|
## v0.0.8
|
|
6
11
|
- Model post requests.
|
|
7
12
|
- Added onFinished callback.
|
package/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ declare class Request extends Mixins {
|
|
|
88
88
|
onForbidden(callback?: (response: Response) => void): this;
|
|
89
89
|
triggerResponseEvents(response: Response, successResponse?: any): Promise<void>;
|
|
90
90
|
customParameters(parameters?: object): this;
|
|
91
|
+
setConfig(config: object): this;
|
|
91
92
|
setApi(api: Api): this;
|
|
92
93
|
}
|
|
93
94
|
|
package/package.json
CHANGED
package/src/api.js
CHANGED
package/src/connection.js
CHANGED
package/src/request.js
CHANGED
|
@@ -59,6 +59,17 @@ export default class Request {
|
|
|
59
59
|
return this;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @param {object} config
|
|
64
|
+
*
|
|
65
|
+
* @returns {this} The current instance.
|
|
66
|
+
*/
|
|
67
|
+
setConfig (config) {
|
|
68
|
+
this._connection.setConfig(_.merge(this._connection.getConfig(), config));
|
|
69
|
+
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
/**
|
|
63
74
|
* @returns {this} The current instance.
|
|
64
75
|
*/
|
|
@@ -98,7 +109,7 @@ export default class Request {
|
|
|
98
109
|
|
|
99
110
|
this._response = await this._connection.post(
|
|
100
111
|
url,
|
|
101
|
-
data,
|
|
112
|
+
{ ...data, ...this.bodyParameters },
|
|
102
113
|
);
|
|
103
114
|
|
|
104
115
|
await this.triggerResponseEvents(this._response);
|
|
@@ -154,7 +165,7 @@ export default class Request {
|
|
|
154
165
|
|
|
155
166
|
this._connection.cancelRunning(this);
|
|
156
167
|
|
|
157
|
-
this.
|
|
168
|
+
this.setConfig({
|
|
158
169
|
headers: {
|
|
159
170
|
'Content-Type': 'multipart/form-data',
|
|
160
171
|
},
|