@whitesev/utils 2.6.3 → 2.6.5

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.
@@ -17,6 +17,15 @@ export class UtilsGMCookie {
17
17
  this.windowApi = Object.assign({}, windowApiOption);
18
18
  }
19
19
  }
20
+ /**
21
+ * 获取Cookie分组
22
+ */
23
+ private getCookiesList() {
24
+ if (this.windowApi.document.cookie.trim() === "") {
25
+ return [];
26
+ }
27
+ return this.windowApi.document.cookie.split(";");
28
+ }
20
29
  /**
21
30
  * 获取单个cookie
22
31
  * @param cookieName cookie名
@@ -25,8 +34,7 @@ export class UtilsGMCookie {
25
34
  if (typeof cookieName !== "string") {
26
35
  throw new TypeError("Utils.GMCookie.get 参数cookieName 必须为字符串");
27
36
  }
28
-
29
- let cookies = this.windowApi.document.cookie.split(";");
37
+ let cookies = this.getCookiesList();
30
38
  let findValue: UtilsGMCookieResult | undefined = void 0;
31
39
  for (const cookieItem of cookies) {
32
40
  let item = cookieItem.trim();
@@ -75,7 +83,7 @@ export class UtilsGMCookie {
75
83
  path: "/",
76
84
  };
77
85
  defaultOption = Utils.assign(defaultOption, option);
78
- let cookies = this.windowApi.document.cookie.split(";");
86
+ let cookies = this.getCookiesList();
79
87
  cookies.forEach((item) => {
80
88
  item = item.trim();
81
89
  let itemSplit = item.split("=");
@@ -126,7 +134,7 @@ export class UtilsGMCookie {
126
134
  path: "/",
127
135
  };
128
136
  defaultOption = Utils.assign(defaultOption, option);
129
- let cookies = this.windowApi.document.cookie.split(";");
137
+ let cookies = this.getCookiesList();
130
138
  cookies.forEach((item) => {
131
139
  item = item.trim();
132
140
  let itemSplit = item.split("=");
@@ -235,6 +243,9 @@ export class UtilsGMCookie {
235
243
  * @param cookieStr
236
244
  */
237
245
  parseCookie(cookieStr: string) {
246
+ if (cookieStr.trim() === "") {
247
+ return [];
248
+ }
238
249
  let cookies = cookieStr.split(";");
239
250
  let result: { key: string; value: string }[] = [];
240
251
  for (const cookieItem of cookies) {
@@ -62,6 +62,19 @@ export type HttpxStatus =
62
62
  | 510
63
63
  | 511;
64
64
 
65
+ /**
66
+ * HTTP WebDav的请求方法
67
+ * + https://blog.csdn.net/weixin_48421613/article/details/128611546
68
+ */
69
+ export type HttpxWebDavMethod =
70
+ | "PROPFIND"
71
+ | "PROPPATCH"
72
+ | "MKCOL"
73
+ | "MOVE"
74
+ | "COPY"
75
+ | "LOCK"
76
+ | "UNLOCK";
77
+
65
78
  /**
66
79
  * HTTP 请求方法
67
80
  * + https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Methods
@@ -75,7 +88,8 @@ export type HttpxMethod =
75
88
  | "CONNECT"
76
89
  | "OPTIONS"
77
90
  | "TRACE"
78
- | "PATCH";
91
+ | "PATCH"
92
+ | HttpxWebDavMethod;
79
93
 
80
94
  /**
81
95
  * 重定向参数