@marianmeres/http-utils 1.6.4 → 1.7.1

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/dist/api.d.ts CHANGED
@@ -5,7 +5,7 @@ interface BaseParams {
5
5
  interface FetchParams {
6
6
  data?: any;
7
7
  token?: string | null;
8
- headers?: any;
8
+ headers?: null | Record<string, string>;
9
9
  signal?: any;
10
10
  credentials?: null | 'omit' | 'same-origin' | 'include';
11
11
  raw?: null | boolean;
package/dist/index.cjs CHANGED
@@ -15,8 +15,9 @@ class HTTP_STATUS {
15
15
  // prettier-ignore
16
16
  static SUCCESS = {
17
17
  OK: { CODE: 200, TEXT: 'OK' },
18
- NON_AUTHORITATIVE_INFO: { CODE: 203, TEXT: 'Non-Authoritative Information' },
18
+ CREATED: { CODE: 201, TEXT: 'Created' },
19
19
  ACCEPTED: { CODE: 202, TEXT: 'Accepted' },
20
+ NON_AUTHORITATIVE_INFO: { CODE: 203, TEXT: 'Non-Authoritative Information' },
20
21
  NO_CONTENT: { CODE: 204, TEXT: 'No Content' },
21
22
  RESET_CONTENT: { CODE: 205, TEXT: 'Reset Content' },
22
23
  PARTIAL_CONTENT: { CODE: 206, TEXT: 'Partial Content' },
@@ -254,7 +255,7 @@ cause) => {
254
255
  };
255
256
 
256
257
  const _fetchRaw = async ({ method, path, data = null, token = null, headers = null, signal = null, credentials, }) => {
257
- headers = Object.entries(headers || {}).map(([k, v]) => ({ [k.toLowerCase()]: v }));
258
+ headers = Object.entries(headers || {}).reduce((m, [k, v]) => ({ ...m, [k.toLowerCase()]: v }), {});
258
259
  const opts = { method, credentials, headers, signal };
259
260
  if (data) {
260
261
  const isObj = typeof data === 'object';
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ class HTTP_STATUS {
13
13
  // prettier-ignore
14
14
  static SUCCESS = {
15
15
  OK: { CODE: 200, TEXT: 'OK' },
16
- NON_AUTHORITATIVE_INFO: { CODE: 203, TEXT: 'Non-Authoritative Information' },
16
+ CREATED: { CODE: 201, TEXT: 'Created' },
17
17
  ACCEPTED: { CODE: 202, TEXT: 'Accepted' },
18
+ NON_AUTHORITATIVE_INFO: { CODE: 203, TEXT: 'Non-Authoritative Information' },
18
19
  NO_CONTENT: { CODE: 204, TEXT: 'No Content' },
19
20
  RESET_CONTENT: { CODE: 205, TEXT: 'Reset Content' },
20
21
  PARTIAL_CONTENT: { CODE: 206, TEXT: 'Partial Content' },
@@ -252,7 +253,7 @@ cause) => {
252
253
  };
253
254
 
254
255
  const _fetchRaw = async ({ method, path, data = null, token = null, headers = null, signal = null, credentials, }) => {
255
- headers = Object.entries(headers || {}).map(([k, v]) => ({ [k.toLowerCase()]: v }));
256
+ headers = Object.entries(headers || {}).reduce((m, [k, v]) => ({ ...m, [k.toLowerCase()]: v }), {});
256
257
  const opts = { method, credentials, headers, signal };
257
258
  if (data) {
258
259
  const isObj = typeof data === 'object';
package/dist/status.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare class HTTP_STATUS {
22
22
  CODE: number;
23
23
  TEXT: string;
24
24
  };
25
- NON_AUTHORITATIVE_INFO: {
25
+ CREATED: {
26
26
  CODE: number;
27
27
  TEXT: string;
28
28
  };
@@ -30,6 +30,10 @@ export declare class HTTP_STATUS {
30
30
  CODE: number;
31
31
  TEXT: string;
32
32
  };
33
+ NON_AUTHORITATIVE_INFO: {
34
+ CODE: number;
35
+ TEXT: string;
36
+ };
33
37
  NO_CONTENT: {
34
38
  CODE: number;
35
39
  TEXT: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/http-utils",
3
- "version": "1.6.4",
3
+ "version": "1.7.1",
4
4
  "description": "Misc DRY http fetch related helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",