@osimatic/helpers-js 1.1.4 → 1.1.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/date_time.js +1 -1
- package/http_client.js +9 -6
- package/package.json +1 -1
package/date_time.js
CHANGED
|
@@ -39,7 +39,7 @@ class DateTimeFormatter {
|
|
|
39
39
|
static getTimeSqlFormatter(timeZone) {
|
|
40
40
|
this.timeSqlFormatter = this.timeSqlFormatter || {};
|
|
41
41
|
if (typeof this.timeSqlFormatter[timeZone] == 'undefined') {
|
|
42
|
-
console.log('init getTimeSqlFormatter avec timezone', timeZone);
|
|
42
|
+
//console.log('init getTimeSqlFormatter avec timezone', timeZone);
|
|
43
43
|
this.timeSqlFormatter[timeZone] = new Intl.DateTimeFormat('en-GB', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: false, timeZone: timeZone }); //hour12: false = 24h format
|
|
44
44
|
}
|
|
45
45
|
|
package/http_client.js
CHANGED
|
@@ -184,9 +184,11 @@ 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
|
-
|
|
189
|
+
headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
|
190
|
+
// 30/01/2023 : ajout encodeURIComponent() sinon les valeurs contenant des "+" pose pb (signe "+" retiré)
|
|
191
|
+
body = encodeURIComponent(new URLSearchParams(HTTPClient.formatFormData(data)).toString());
|
|
190
192
|
}
|
|
191
193
|
else if ('POST' === method) {
|
|
192
194
|
body = HTTPClient.formatFormData(data);
|
|
@@ -197,7 +199,7 @@ class HTTPClient {
|
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
const requestOptions = {
|
|
200
|
-
headers:
|
|
202
|
+
headers: headers,
|
|
201
203
|
mode: 'cors',
|
|
202
204
|
cache: 'no-cache',
|
|
203
205
|
method,
|
|
@@ -264,9 +266,10 @@ class HTTPClient {
|
|
|
264
266
|
let body = null;
|
|
265
267
|
method = method.toUpperCase();
|
|
266
268
|
|
|
269
|
+
let headers = HTTPClient.getHeaders();
|
|
267
270
|
if ('PATCH' === method) {
|
|
268
|
-
|
|
269
|
-
body = new URLSearchParams(HTTPClient.formatFormData(data)).toString();
|
|
271
|
+
headers.append('Content-Type', 'application/x-www-form-urlencoded');
|
|
272
|
+
body = encodeURIComponent(new URLSearchParams(HTTPClient.formatFormData(data)).toString());
|
|
270
273
|
}
|
|
271
274
|
else if ('POST' === method) {
|
|
272
275
|
body = HTTPClient.formatFormData(data);
|
|
@@ -278,7 +281,7 @@ class HTTPClient {
|
|
|
278
281
|
|
|
279
282
|
const requestOptions = {
|
|
280
283
|
method: method,
|
|
281
|
-
headers:
|
|
284
|
+
headers: headers,
|
|
282
285
|
body: body,
|
|
283
286
|
mode: 'cors',
|
|
284
287
|
cache: 'no-cache'
|