@tarojs/plugin-http 3.6.7-alpha.0 → 3.6.7-alpha.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/runtime.js +10 -1
- package/package.json +4 -4
- package/src/runtime/XMLHttpRequest.ts +2 -1
- package/src/runtime/index.ts +6 -0
package/dist/runtime.js
CHANGED
|
@@ -17,6 +17,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
17
17
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
19
|
***************************************************************************** */
|
|
20
|
+
/* global Reflect, Promise */
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
22
24
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -574,7 +576,8 @@ _XMLHttpRequest_method = new WeakMap(), _XMLHttpRequest_url = new WeakMap(), _XM
|
|
|
574
576
|
url = url.indexOf('//') === -1 ? window.location.origin + url : url;
|
|
575
577
|
// 头信息
|
|
576
578
|
const header = Object.assign({}, __classPrivateFieldGet(this, _XMLHttpRequest_header, "f"));
|
|
577
|
-
|
|
579
|
+
// https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies
|
|
580
|
+
header.cookie = window.document.$$cookie;
|
|
578
581
|
if (!this.withCredentials) {
|
|
579
582
|
// 不同源,要求 withCredentials 为 true 才携带 cookie
|
|
580
583
|
const { origin } = parseUrl(url);
|
|
@@ -681,6 +684,12 @@ if (!isWebPlatform()) {
|
|
|
681
684
|
_cookie.setCookie(value, this.URL);
|
|
682
685
|
},
|
|
683
686
|
},
|
|
687
|
+
/** 获取完整的 cookie,包括 httpOnly 也能获取到 */
|
|
688
|
+
$$cookie: {
|
|
689
|
+
get() {
|
|
690
|
+
return _cookie.getCookie(this.URL, true);
|
|
691
|
+
},
|
|
692
|
+
}
|
|
684
693
|
});
|
|
685
694
|
}
|
|
686
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-alpha.
|
|
3
|
+
"version": "3.6.7-alpha.1",
|
|
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-alpha.
|
|
27
|
-
"@tarojs/service": "3.6.7-alpha.
|
|
28
|
-
"@tarojs/shared": "3.6.7-alpha.
|
|
26
|
+
"@tarojs/runtime": "3.6.7-alpha.1",
|
|
27
|
+
"@tarojs/service": "3.6.7-alpha.1",
|
|
28
|
+
"@tarojs/shared": "3.6.7-alpha.1"
|
|
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
|
-
|
|
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)
|