Skip to content

Commit a6df6fc

Browse files
committed
环境对比测试:其它环境同时兼容 HTTP URL 和数据库 URI 两种设置
1 parent 9982cbb commit a6df6fc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

js/main.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,7 +4229,8 @@ https://github.com/Tencent/APIJSON/issues
42294229
this.onChange(false)
42304230
}
42314231
this.request(isAdminOperation, REQUEST_TYPE_JSON, this.server + '/login', req, {},function (url, res, err) {
4232-
if (App.isEnvCompareEnabled != true) {
4232+
var otherEnv = App.otherEnv || ''
4233+
if (App.isEnvCompareEnabled != true || (otherEnv.startsWith('http://') != true && otherEnv.startsWith('https://') != true)) {
42334234
if (callback) {
42344235
callback(url, res, err)
42354236
return
@@ -4416,8 +4417,9 @@ https://github.com/Tencent/APIJSON/issues
44164417
this.scripts = newDefaultScript()
44174418
this.showTestCase(false, this.isLocalShow)
44184419
this.onChange(false)
4419-
this.request(isAdminOperation, REQUEST_TYPE_JSON, this.server + '/logout', req, {}, function (url_, res_, err_) {
4420-
if (App.isEnvCompareEnabled != true) {
4420+
this.request(isAdminOperation, REQUEST_TYPE_JSON, this.server + '/logout', req, {}, function (url, res, err) {
4421+
var otherEnv = App.otherEnv || ''
4422+
if (App.isEnvCompareEnabled != true || (otherEnv.startsWith('http://') != true && otherEnv.startsWith('https://') != true)) {
44214423
if (callback) {
44224424
callback(url, res, err)
44234425
}
@@ -7848,9 +7850,11 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
78487850
const standardKey = isMLEnabled != true ? 'response' : 'standard'
78497851

78507852
const otherEnv = this.otherEnv;
7851-
const otherBaseUri = this.isEnvCompareEnabled && StringUtil.isNotEmpty(otherEnv, true) ? this.getBaseUrl(otherEnv) : null
7853+
const otherBaseUri = this.isEnvCompareEnabled && StringUtil.isNotEmpty(otherEnv, true) ? this.getBaseUrl(otherEnv) : ""
78527854
const isEnvCompare = StringUtil.isNotEmpty(otherBaseUri, true) // 对比自己也行,看看前后两次是否幂等 && otherBaseUrl != baseUrl
78537855
const apiUrl = this.server + '/sql/execute'
7856+
const isHttp = otherBaseUri != null && (otherBaseUri.startsWith('http://') || otherBaseUri.startsWith('https://'))
7857+
const url = isEnvCompare && isHttp ? otherBaseUri + '/sql/execute' : apiUrl
78547858

78557859
for (var i = 0; i < allCount; i++) {
78567860
const item = list[i]
@@ -7887,11 +7891,11 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
78877891

78887892
const type = document.type
78897893
const curUri = baseUrl + document.url
7890-
const otherUri = otherBaseUri + document.url
7894+
const otherUri = isHttp ? curUri : otherBaseUri + document.url
78917895

78927896
this.parseRandom(document.sqlauto, document.header, -1
78937897
, true, false, false, function (randomName, constConfig, constJson) {
7894-
App.request(false, type, apiUrl, Object.assign(constJson, {
7898+
App.request(false, type, url, Object.assign(constJson, {
78957899
uri: isEnvCompare ? otherUri : curUri
78967900
}), {}, function (url, res, err) {
78977901
if (isEnvCompare != true) {

0 commit comments

Comments
 (0)