@tarojs/plugin-http 3.6.22-nightly.0 → 3.6.22-nightly.4
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/LICENSE +7 -0
- package/dist/runtime.js +4 -3
- package/package.json +5 -5
- package/src/runtime/XMLHttpRequest.ts +3 -2
- package/src/runtime/index.ts +2 -3
package/LICENSE
CHANGED
|
@@ -158,3 +158,10 @@ MIT (stencil-vue2-output-target):
|
|
|
158
158
|
The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
|
|
159
159
|
`/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
|
|
160
160
|
See `/LICENSE` for details of the license.
|
|
161
|
+
|
|
162
|
+
==================
|
|
163
|
+
|
|
164
|
+
MIT (weui):
|
|
165
|
+
The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
|
|
166
|
+
`/packages/taro-components/src/components/*.scss`
|
|
167
|
+
See `/LICENSE.txt` for details of the license.
|
package/dist/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseUrl, Events, createEvent, window, document } from '@tarojs/runtime';
|
|
2
2
|
export { document } from '@tarojs/runtime';
|
|
3
|
-
import { isString, isFunction, isWebPlatform } from '@tarojs/shared';
|
|
4
3
|
import { setStorage, getStorageSync, request } from '@tarojs/taro';
|
|
4
|
+
import { isString, isFunction } from '@tarojs/shared';
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
7
7
|
Copyright (c) Microsoft Corporation.
|
|
@@ -580,6 +580,7 @@ _XMLHttpRequest_method = new WeakMap(), _XMLHttpRequest_url = new WeakMap(), _XM
|
|
|
580
580
|
// 头信息
|
|
581
581
|
const header = Object.assign({}, __classPrivateFieldGet(this, _XMLHttpRequest_header, "f"));
|
|
582
582
|
// https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies
|
|
583
|
+
// @ts-ignore
|
|
583
584
|
header.cookie = window.document.$$cookie;
|
|
584
585
|
if (!this.withCredentials) {
|
|
585
586
|
// 不同源,要求 withCredentials 为 true 才携带 cookie
|
|
@@ -648,7 +649,7 @@ _XMLHttpRequest_method = new WeakMap(), _XMLHttpRequest_url = new WeakMap(), _XM
|
|
|
648
649
|
}
|
|
649
650
|
}, _XMLHttpRequest_requestFail = function _XMLHttpRequest_requestFail(err) {
|
|
650
651
|
// 微信小程序,无论接口返回200还是其他,响应无论是否有错误,都会进入 success 回调;只有类似超时这种请求错误才会进入 fail 回调
|
|
651
|
-
//
|
|
652
|
+
//
|
|
652
653
|
/**
|
|
653
654
|
* 阿里系小程序,接口返回非200状态码,会进入 fail 回调, 此时 err 对象结构如下(当错误码为 14 或 19 时,会多返回 status、data、headers。可通过这些字段获取服务端相关错误信息):
|
|
654
655
|
{
|
|
@@ -690,7 +691,7 @@ XMLHttpRequest.HEADERS_RECEIVED = 2;
|
|
|
690
691
|
XMLHttpRequest.LOADING = 3;
|
|
691
692
|
XMLHttpRequest.DONE = 4;
|
|
692
693
|
|
|
693
|
-
if (
|
|
694
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
694
695
|
if (ENABLE_COOKIE) {
|
|
695
696
|
const _cookie = createCookieInstance();
|
|
696
697
|
Object.defineProperties(document, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/plugin-http",
|
|
3
|
-
"version": "3.6.22-nightly.
|
|
3
|
+
"version": "3.6.22-nightly.4",
|
|
4
4
|
"description": "Taro 小程序端支持使用 web 请求 的插件",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/NervJS/taro#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tarojs/runtime": "3.6.22-nightly.
|
|
27
|
-
"@tarojs/
|
|
28
|
-
"@tarojs/
|
|
26
|
+
"@tarojs/runtime": "3.6.22-nightly.4",
|
|
27
|
+
"@tarojs/shared": "3.6.22-nightly.4",
|
|
28
|
+
"@tarojs/service": "3.6.22-nightly.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@rollup/plugin-json": "^
|
|
31
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
32
32
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
33
33
|
"jest": "^29.3.1",
|
|
34
34
|
"jest-cli": "^29.3.1",
|
|
@@ -83,7 +83,7 @@ function createXMLHttpRequestEvent (event: string, target:XMLHttpRequest, loaded
|
|
|
83
83
|
})
|
|
84
84
|
} catch (err) {
|
|
85
85
|
// no handler
|
|
86
|
-
}
|
|
86
|
+
}
|
|
87
87
|
return e
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -226,6 +226,7 @@ export class XMLHttpRequest extends Events {
|
|
|
226
226
|
// 头信息
|
|
227
227
|
const header = Object.assign({}, this.#header)
|
|
228
228
|
// https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Cookies
|
|
229
|
+
// @ts-ignore
|
|
229
230
|
header.cookie = window.document.$$cookie
|
|
230
231
|
if (!this.withCredentials) {
|
|
231
232
|
// 不同源,要求 withCredentials 为 true 才携带 cookie
|
|
@@ -314,7 +315,7 @@ export class XMLHttpRequest extends Events {
|
|
|
314
315
|
*/
|
|
315
316
|
#requestFail (err) {
|
|
316
317
|
// 微信小程序,无论接口返回200还是其他,响应无论是否有错误,都会进入 success 回调;只有类似超时这种请求错误才会进入 fail 回调
|
|
317
|
-
//
|
|
318
|
+
//
|
|
318
319
|
/**
|
|
319
320
|
* 阿里系小程序,接口返回非200状态码,会进入 fail 回调, 此时 err 对象结构如下(当错误码为 14 或 19 时,会多返回 status、data、headers。可通过这些字段获取服务端相关错误信息):
|
|
320
321
|
{
|
package/src/runtime/index.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { document, window } from '@tarojs/runtime'
|
|
2
|
-
import { isWebPlatform } from '@tarojs/shared'
|
|
3
2
|
|
|
4
3
|
import { Cookie, createCookieInstance } from './Cookie'
|
|
5
4
|
import { type XMLHttpRequestEvent, XMLHttpRequest } from './XMLHttpRequest'
|
|
6
5
|
|
|
7
6
|
declare const ENABLE_COOKIE: boolean
|
|
8
7
|
|
|
9
|
-
if (
|
|
8
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
10
9
|
if (ENABLE_COOKIE) {
|
|
11
10
|
const _cookie = createCookieInstance()
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
Object.defineProperties(document, {
|
|
14
13
|
URL: {
|
|
15
14
|
get () {
|