@jetbrains/ring-ui 4.2.11 → 4.2.12
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/components/http/http.js +19 -8
- package/dist/http/http.js +20 -6
- package/package.json +2 -2
package/components/http/http.js
CHANGED
|
@@ -30,6 +30,17 @@ export const CODE = {
|
|
|
30
30
|
UNAUTHORIZED: 401
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
function withMethodWarning(fn) {
|
|
34
|
+
return (url, params) => {
|
|
35
|
+
if (params && 'method' in params) {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.warn(`Ring UI HTTP misuse: {method: '${params.method}'} is passed to http.post() or http.get() (url="${url}").
|
|
38
|
+
This is a bug exploitation and will not work in next release.`);
|
|
39
|
+
}
|
|
40
|
+
return fn(url, params);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
export default class HTTP {
|
|
34
45
|
baseUrl = null;
|
|
35
46
|
_requestsMeta = new WeakMap();
|
|
@@ -180,19 +191,19 @@ export default class HTTP {
|
|
|
180
191
|
|
|
181
192
|
getMetaForResponse = response => this._requestsMeta.get(response);
|
|
182
193
|
|
|
183
|
-
get = (url, params) => (
|
|
194
|
+
get = withMethodWarning((url, params) => (
|
|
184
195
|
this.request(url, {
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
method: 'GET',
|
|
197
|
+
...params
|
|
187
198
|
})
|
|
188
|
-
);
|
|
199
|
+
));
|
|
189
200
|
|
|
190
|
-
post = (url, params) => (
|
|
201
|
+
post = withMethodWarning((url, params) => (
|
|
191
202
|
this.request(url, {
|
|
192
|
-
|
|
193
|
-
|
|
203
|
+
method: 'POST',
|
|
204
|
+
...params
|
|
194
205
|
})
|
|
195
|
-
);
|
|
206
|
+
));
|
|
196
207
|
|
|
197
208
|
delete = (url, params) => (
|
|
198
209
|
this.request(url, {
|
package/dist/http/http.js
CHANGED
|
@@ -30,6 +30,18 @@ class HTTPError extends ExtendableError {
|
|
|
30
30
|
const CODE = {
|
|
31
31
|
UNAUTHORIZED: 401
|
|
32
32
|
};
|
|
33
|
+
|
|
34
|
+
function withMethodWarning(fn) {
|
|
35
|
+
return (url, params) => {
|
|
36
|
+
if (params && 'method' in params) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.warn("Ring UI HTTP misuse: {method: '".concat(params.method, "'} is passed to http.post() or http.get() (url=\"").concat(url, "\").\nThis is a bug exploitation and will not work in next release."));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return fn(url, params);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
class HTTP {
|
|
34
46
|
constructor(_auth, _baseUrl) {
|
|
35
47
|
var _this = this;
|
|
@@ -91,13 +103,15 @@ class HTTP {
|
|
|
91
103
|
|
|
92
104
|
_defineProperty(this, "getMetaForResponse", response => this._requestsMeta.get(response));
|
|
93
105
|
|
|
94
|
-
_defineProperty(this, "get", (url, params) => this.request(url, {
|
|
95
|
-
method: 'GET'
|
|
96
|
-
|
|
106
|
+
_defineProperty(this, "get", withMethodWarning((url, params) => this.request(url, {
|
|
107
|
+
method: 'GET',
|
|
108
|
+
...params
|
|
109
|
+
})));
|
|
97
110
|
|
|
98
|
-
_defineProperty(this, "post", (url, params) => this.request(url, {
|
|
99
|
-
method: 'POST'
|
|
100
|
-
|
|
111
|
+
_defineProperty(this, "post", withMethodWarning((url, params) => this.request(url, {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
...params
|
|
114
|
+
})));
|
|
101
115
|
|
|
102
116
|
_defineProperty(this, "delete", (url, params) => this.request(url, { ...params,
|
|
103
117
|
method: 'DELETE'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.12",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -221,5 +221,5 @@
|
|
|
221
221
|
"node": ">=7.4",
|
|
222
222
|
"npm": ">=6.0.0"
|
|
223
223
|
},
|
|
224
|
-
"gitHead": "
|
|
224
|
+
"gitHead": "ff38a49c14239ec1b15a2377babd040794af835d"
|
|
225
225
|
}
|