etherreq 1.2.5 → 1.2.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/dist/etherreq.js CHANGED
@@ -4,7 +4,14 @@ export const create = (defaultConfig = {}) => {
4
4
  const responseInterceptors = [];
5
5
  const client = async (config) => {
6
6
  // 合并默认配置
7
- const mergedConfig = { ...defaultConfig, ...config };
7
+ const mergedConfig = {
8
+ ...defaultConfig,
9
+ ...config,
10
+ headers: {
11
+ ...defaultConfig.headers,
12
+ ...config.headers
13
+ }
14
+ };
8
15
  // 应用请求拦截器
9
16
  let processedConfig = { ...mergedConfig };
10
17
  for (const interceptor of requestInterceptors) {
@@ -36,7 +43,7 @@ export const create = (defaultConfig = {}) => {
36
43
  data,
37
44
  status: response.status,
38
45
  statusText: response.statusText,
39
- headers: response.headers,
46
+ headers: Object.fromEntries(response.headers.entries()), // 将Headers对象转换为普通对象
40
47
  config: processedConfig,
41
48
  };
42
49
  // 应用响应拦截器
@@ -3,7 +3,9 @@ export declare const create: (defaultConfig?: any) => {
3
3
  data: any;
4
4
  status: number;
5
5
  statusText: string;
6
- headers: Headers;
6
+ headers: {
7
+ [k: string]: string;
8
+ };
7
9
  config: any;
8
10
  }>;
9
11
  interceptors: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etherreq",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "A lightweight custom HTTP request library with TypeScript support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",