Skip to content

Commit c2be96b

Browse files
author
HadiChan
committed
edit
1 parent 39cfb0e commit c2be96b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/request.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ function request (url, body, method, headers, api) {
2020

2121
// 执行发送请求
2222
function requestRun (url, body, method, headers, api) {
23-
if (api && typeof api.wsRequest === 'function' && api.socketState === 1) {
23+
var hostSame = false
24+
// 是否有长链接地址
25+
if (api.webSocketUrl && typeof api.webSocketUrl === 'string') {
26+
// 地址是否一致
27+
hostSame = api.url.parse(api.webSocketUrl).host === api.url.parse(url).host
28+
}
29+
30+
if (api && typeof api.wsRequest === 'function' && api.socketState === 1 && hostSame) {
2431
var cb = api.wsRequest(url, body, method, headers)
2532

2633
if (cb && (typeof cb.then === 'function')) {

0 commit comments

Comments
 (0)