@aliyun-obv/api 0.4.0-beta.5 → 0.4.0-beta.7
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/api.d.ts +1 -0
- package/dist/api.es.js +12 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
package/dist/api.es.js
CHANGED
|
@@ -101,6 +101,17 @@ class BaseFetch {
|
|
|
101
101
|
if (hasBaseURL && !(url.startsWith("http:") || url.startsWith("https:"))) {
|
|
102
102
|
url = `${this.defaults.baseURL}${url}`;
|
|
103
103
|
}
|
|
104
|
+
try {
|
|
105
|
+
if (options && options.reason) {
|
|
106
|
+
const reason = encodeURIComponent(options.reason);
|
|
107
|
+
if (url.includes("?")) {
|
|
108
|
+
url = `${url}&__reason__=${reason}`;
|
|
109
|
+
} else {
|
|
110
|
+
url = `${url}?__reason__=${reason}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
}
|
|
104
115
|
if ((url.startsWith("http:") || url.startsWith("https:")) && !url.startsWith(window.location.host)) {
|
|
105
116
|
newInit = __spreadValues$5({}, Object.assign({}, init, { credentials: "include" }));
|
|
106
117
|
}
|
|
@@ -142,7 +153,7 @@ class BaseFetch {
|
|
|
142
153
|
this.defaults.getDefaultInit,
|
|
143
154
|
options
|
|
144
155
|
);
|
|
145
|
-
const url = `${newApi}?${getParams(params)}`;
|
|
156
|
+
const url = newApi.includes("?") ? `${newApi}&${getParams(params)}` : `${newApi}?${getParams(params)}`;
|
|
146
157
|
const res = yield this.callFetch(url, newInit, options);
|
|
147
158
|
if (this.defaults.afterResponse) {
|
|
148
159
|
return yield this.defaults.afterResponse(res, options);
|
package/package.json
CHANGED