Skip to content

Commit 0ea7c5e

Browse files
committed
解决通过代理执行 SQL 时传递参数多了浏览器加的 HTTP Header
1 parent b93bd83 commit 0ea7c5e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

js/main.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5075,13 +5075,25 @@ https://github.com/Tencent/APIJSON/issues
50755075
var evalPostScript = function () {}
50765076

50775077
var sendRequest = function (isAdminOperation, type, url, req, header, callback) {
5078+
var hs = ""
5079+
if (isDelegate && header != null) {
5080+
for (var k in header) {
5081+
var v = k == null ? null : header[k]
5082+
if (k == null || k.toLowerCase() == 'apijson-delegate-id') {
5083+
continue
5084+
}
5085+
hs += '\n' + k + ': ' + (v instanceof Object ? JSON.stringify(v) : v)
5086+
}
5087+
}
5088+
50785089
// axios.defaults.withcredentials = true
50795090
axios({
50805091
method: (type == REQUEST_TYPE_PARAM ? 'get' : 'post'),
5081-
url: (isDelegate
5082-
? (
5092+
url: (isDelegate ? (
50835093
App.server + '/delegate?' + (type == REQUEST_TYPE_GRPC ? '$_type=GRPC&' : '')
5084-
+ (StringUtil.isEmpty(App.delegateId, true) ? '' : '$_delegate_id=' + App.delegateId + '&') + '$_delegate_url=' + encodeURIComponent(url)
5094+
+ (StringUtil.isEmpty(App.delegateId, true) ? '' : '$_delegate_id=' + App.delegateId + '&')
5095+
+ '$_delegate_url=' + encodeURIComponent(url)
5096+
+ (StringUtil.isEmpty(hs, true) ? '' : '&$_headers=' + encodeURIComponent(hs.trim()))
50855097
) : (
50865098
App.isEncodeEnabled ? encodeURI(url) : url
50875099
)

0 commit comments

Comments
 (0)