@osimatic/helpers-js 1.1.4 → 1.1.5
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/http_client.js +6 -4
- package/package.json +1 -1
package/http_client.js
CHANGED
|
@@ -184,8 +184,9 @@ class HTTPClient {
|
|
|
184
184
|
let body = null;
|
|
185
185
|
method = method.toUpperCase();
|
|
186
186
|
|
|
187
|
+
let headers = HTTPClient.getHeaders();
|
|
187
188
|
if ('PATCH' === method) {
|
|
188
|
-
|
|
189
|
+
headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
|
189
190
|
body = new URLSearchParams(HTTPClient.formatFormData(data)).toString();
|
|
190
191
|
}
|
|
191
192
|
else if ('POST' === method) {
|
|
@@ -197,7 +198,7 @@ class HTTPClient {
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
const requestOptions = {
|
|
200
|
-
headers:
|
|
201
|
+
headers: headers,
|
|
201
202
|
mode: 'cors',
|
|
202
203
|
cache: 'no-cache',
|
|
203
204
|
method,
|
|
@@ -264,8 +265,9 @@ class HTTPClient {
|
|
|
264
265
|
let body = null;
|
|
265
266
|
method = method.toUpperCase();
|
|
266
267
|
|
|
268
|
+
let headers = HTTPClient.getHeaders();
|
|
267
269
|
if ('PATCH' === method) {
|
|
268
|
-
|
|
270
|
+
headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
|
269
271
|
body = new URLSearchParams(HTTPClient.formatFormData(data)).toString();
|
|
270
272
|
}
|
|
271
273
|
else if ('POST' === method) {
|
|
@@ -278,7 +280,7 @@ class HTTPClient {
|
|
|
278
280
|
|
|
279
281
|
const requestOptions = {
|
|
280
282
|
method: method,
|
|
281
|
-
headers:
|
|
283
|
+
headers: headers,
|
|
282
284
|
body: body,
|
|
283
285
|
mode: 'cors',
|
|
284
286
|
cache: 'no-cache'
|