@marianmeres/http-utils 1.6.3 → 1.7.0
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 +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
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?:
|
|
8
|
+
headers?: null | Record<string, string>;
|
|
9
9
|
signal?: any;
|
|
10
10
|
credentials?: null | 'omit' | 'same-origin' | 'include';
|
|
11
11
|
raw?: null | boolean;
|
|
@@ -14,7 +14,7 @@ interface FetchParams {
|
|
|
14
14
|
type BaseFetchParams = BaseParams & FetchParams;
|
|
15
15
|
export declare const createHttpApi: (base?: string | null, defaults?: Partial<BaseFetchParams> | (() => Promise<Partial<BaseFetchParams>>)) => {
|
|
16
16
|
get(path: string, params?: FetchParams, respHeaders?: any, _dumpParams?: boolean): Promise<any>;
|
|
17
|
-
post(path: string, data?:
|
|
17
|
+
post(path: string, data?: any, params?: FetchParams, respHeaders?: any, _dumpParams?: boolean): Promise<any>;
|
|
18
18
|
put(path: string, data?: any, params?: FetchParams, respHeaders?: any, _dumpParams?: boolean): Promise<any>;
|
|
19
19
|
patch(path: string, data?: any, params?: FetchParams, respHeaders?: any, _dumpParams?: boolean): Promise<any>;
|
|
20
20
|
del(path: string, data?: any, params?: FetchParams, respHeaders?: any, _dumpParams?: boolean): Promise<any>;
|
package/dist/index.cjs
CHANGED
|
@@ -254,7 +254,7 @@ cause) => {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
const _fetchRaw = async ({ method, path, data = null, token = null, headers = null, signal = null, credentials, }) => {
|
|
257
|
-
headers = Object.entries(headers || {}).
|
|
257
|
+
headers = Object.entries(headers || {}).reduce((m, [k, v]) => ({ ...m, [k.toLowerCase()]: v }), {});
|
|
258
258
|
const opts = { method, credentials, headers, signal };
|
|
259
259
|
if (data) {
|
|
260
260
|
const isObj = typeof data === 'object';
|
package/dist/index.js
CHANGED
|
@@ -252,7 +252,7 @@ cause) => {
|
|
|
252
252
|
};
|
|
253
253
|
|
|
254
254
|
const _fetchRaw = async ({ method, path, data = null, token = null, headers = null, signal = null, credentials, }) => {
|
|
255
|
-
headers = Object.entries(headers || {}).
|
|
255
|
+
headers = Object.entries(headers || {}).reduce((m, [k, v]) => ({ ...m, [k.toLowerCase()]: v }), {});
|
|
256
256
|
const opts = { method, credentials, headers, signal };
|
|
257
257
|
if (data) {
|
|
258
258
|
const isObj = typeof data === 'object';
|