@tarojs/plugin-http 3.6.7 → 3.6.8

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/runtime.js CHANGED
@@ -576,7 +576,8 @@ _XMLHttpRequest_method = new WeakMap(), _XMLHttpRequest_url = new WeakMap(), _XM
576
576
  url = url.indexOf('//') === -1 ? window.location.origin + url : url;
577
577
  // 头信息
578
578
  const header = Object.assign({}, __classPrivateFieldGet(this, _XMLHttpRequest_header, "f"));
579
- header.cookie = window.document.cookie;
579
+ // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies
580
+ header.cookie = window.document.$$cookie;
580
581
  if (!this.withCredentials) {
581
582
  // 不同源,要求 withCredentials 为 true 才携带 cookie
582
583
  const { origin } = parseUrl(url);
@@ -683,6 +684,12 @@ if (!isWebPlatform()) {
683
684
  _cookie.setCookie(value, this.URL);
684
685
  },
685
686
  },
687
+ /** 获取完整的 cookie,包括 httpOnly 也能获取到 */
688
+ $$cookie: {
689
+ get() {
690
+ return _cookie.getCookie(this.URL, true);
691
+ },
692
+ }
686
693
  });
687
694
  }
688
695
  window.XMLHttpRequest = XMLHttpRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/plugin-http",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "description": "Taro 小程序端支持使用 web 请求 的插件",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "homepage": "https://github.com/NervJS/taro#readme",
25
25
  "dependencies": {
26
- "@tarojs/runtime": "3.6.7",
27
- "@tarojs/service": "3.6.7",
28
- "@tarojs/shared": "3.6.7"
26
+ "@tarojs/runtime": "3.6.8",
27
+ "@tarojs/service": "3.6.8",
28
+ "@tarojs/shared": "3.6.8"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@rollup/plugin-json": "^4.1.0",
@@ -222,7 +222,8 @@ export class XMLHttpRequest extends Events {
222
222
 
223
223
  // 头信息
224
224
  const header = Object.assign({}, this.#header)
225
- header.cookie = window.document.cookie
225
+ // https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies
226
+ header.cookie = window.document.$$cookie
226
227
  if (!this.withCredentials) {
227
228
  // 不同源,要求 withCredentials 为 true 才携带 cookie
228
229
  const { origin } = parseUrl(url)
@@ -26,6 +26,12 @@ if (!isWebPlatform()) {
26
26
  _cookie.setCookie(value, this.URL)
27
27
  },
28
28
  },
29
+ /** 获取完整的 cookie,包括 httpOnly 也能获取到 */
30
+ $$cookie: {
31
+ get () {
32
+ return _cookie.getCookie(this.URL, true)
33
+ },
34
+ }
29
35
  })
30
36
  }
31
37