@alipay/ams-checkout 0.0.1755258862-dev.1 → 0.0.1755258862-dev.3
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.
@@ -129,7 +129,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
129
129
|
traceId: traceId,
|
130
130
|
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
131
131
|
});
|
132
|
-
console.log('[DEBUG] request error 1', _error);
|
132
|
+
console.log('[DEBUG] request error 1', _error, 'Original error:', _context.t0);
|
133
133
|
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
134
134
|
_errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
|
135
135
|
this.reportRequestTimeCost({
|
@@ -207,23 +207,36 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
207
207
|
key: "createRequestInstance",
|
208
208
|
value: function createRequestInstance(options) {
|
209
209
|
var _options$timeout, _options$withCredenti;
|
210
|
+
console.log('[DEBUG] createRequestInstance start with options:', {
|
211
|
+
env: options.env,
|
212
|
+
'Operation-Type': options['Operation-Type'],
|
213
|
+
hostSign: options === null || options === void 0 ? void 0 : options.hostSign,
|
214
|
+
timeout: options.timeout,
|
215
|
+
method: options === null || options === void 0 ? void 0 : options.method,
|
216
|
+
withCredentials: options.withCredentials,
|
217
|
+
headers: Object.keys(options.headers || {})
|
218
|
+
});
|
210
219
|
var date = new Date(); // 获取当前时间
|
211
220
|
var timestamp = date.getTime(); // 获取时间戳
|
212
221
|
var utcTimestamp = timestamp + date.getTimezoneOffset() * 60 * 1000; // 获取 UTC 时间戳
|
213
222
|
var env = options.env || 'prod';
|
214
223
|
var lightSandboxConfig = lightSandboxMap(options['Operation-Type'], env); // light_sandbox
|
215
|
-
|
224
|
+
console.log('[DEBUG] lightSandboxConfig:', lightSandboxConfig);
|
216
225
|
var baseURL = options.baseURL || lightSandboxConfig.baseURL || hostSignMap(options === null || options === void 0 ? void 0 : options.hostSign, env) || requestHost[env];
|
226
|
+
console.log('[DEBUG] baseURL:', baseURL);
|
217
227
|
var _headers = _objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
218
228
|
appId: lightSandboxConfig.appId || appId,
|
219
229
|
workspaceId: options.env === 'pre' ? 'pre' : 'default'
|
220
230
|
}, "x-cors-".concat(appId.toLowerCase(), "-default"), '1'), "version", '2.0'), 'sofa-group-name', lightSandboxConfig.sofaId || sofaId), 'Operation-Type', lightSandboxConfig['Operation-Type'] || options['Operation-Type'] || ''), 'Client-Time', utcTimestamp), "tntInstId", tntInstId), 'sdk-version', sdkVersion || ''), options.headers);
|
231
|
+
|
221
232
|
// sandbox 影子链路
|
222
233
|
if (this.sandboxFlag === 'true' || env === 'sandbox') {
|
223
234
|
_headers['load-test'] = true;
|
224
235
|
_headers.sofaPenAttrs = 'instMock=O&loadMode=2';
|
225
236
|
}
|
226
237
|
if (env !== 'dev') delete _headers['sofa-group-name'];
|
238
|
+
console.log('[DEBUG] request headers keys:', Object.keys(_headers));
|
239
|
+
console.log('[DEBUG] axios:', axios);
|
227
240
|
var instance = axios.create({
|
228
241
|
baseURL: baseURL,
|
229
242
|
timeout: (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : 15000,
|
@@ -231,7 +244,14 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
231
244
|
withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
|
232
245
|
method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
|
233
246
|
});
|
247
|
+
console.log('[DEBUG] axios instance created with config:', {
|
248
|
+
baseURL: instance.defaults.baseURL,
|
249
|
+
timeout: instance.defaults.timeout,
|
250
|
+
method: instance.defaults.method,
|
251
|
+
withCredentials: instance.defaults.withCredentials
|
252
|
+
});
|
234
253
|
return instance.request;
|
254
|
+
// return instance.request.bind(instance);
|
235
255
|
}
|
236
256
|
}]);
|
237
257
|
return RequesterService;
|