ywana-core8 0.0.373 → 0.0.374

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.373",
3
+ "version": "0.0.374",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -2,17 +2,28 @@ async function fetchAsync(method, URL, body = null, token, headers) {
2
2
 
3
3
  console.log('FETCH', method, URL)
4
4
 
5
+
6
+ const requestHeaders = Object.assign({}, {
7
+ "Accept": "application/json",
8
+ "Content-Type": "application/json",
9
+ "x-access-token": token
10
+ }, headers)
11
+
5
12
  const request = {
6
13
  method,
7
14
  mode: 'cors',
8
- headers: Object.assign({
15
+ headers: {
9
16
  "Accept": "application/json",
10
17
  "Content-Type": "application/json",
11
- "x-access-token": token,
12
- }, headers),
18
+ "x-access-token": token
19
+ },
13
20
  body
14
21
  }
15
22
 
23
+ console.log("HTTP Client", request)
24
+
25
+ if (headers) request.headers = request.headers
26
+
16
27
  try {
17
28
  var response = await fetch(URL, request);
18
29
  if (response.ok) {
@@ -21,7 +32,7 @@ async function fetchAsync(method, URL, body = null, token, headers) {
21
32
  }
22
33
  throw response
23
34
  } catch (error) {
24
- if (error instanceof Error) { throw { error } }
35
+ if (error instanceof Error) { throw { error }}
25
36
  const json = await error.json()
26
37
  throw {
27
38
  success: false,