@aliyun-obv/api 0.4.0-beta.6 → 0.4.0-beta.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/api.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ShowConfig } from '@alifd/next/types/dialog';
4
4
  interface IBaseFetchOptions {
5
5
  forbidAlert?: boolean;
6
6
  headers?: HeadersInit;
7
+ reason?: string;
7
8
  }
8
9
  interface IErrorRequest {
9
10
  method: string;
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
@@ -15,5 +15,5 @@
15
15
  "styled-components": "^5.2.0",
16
16
  "urijs": "^1.19.1"
17
17
  },
18
- "version": "0.4.0-beta.6"
18
+ "version": "0.4.0-beta.8"
19
19
  }