Skip to content

Commit 85d3e5a

Browse files
committed
fix: issue where the access url to expectationManager did not include port
This happened if this.serverAccessBaseUrls was set and port=0.
1 parent 0e35c53 commit 85d3e5a

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

shared/packages/expectationManager/src/internalManager/lib/expectationManagerServer.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,27 @@ export class ExpectationManagerServer {
100100
} else if (this.serverAccessBaseUrls) {
101101
this._serverAccessUrls = this.serverAccessBaseUrls
102102
} else {
103-
let url = 'ws://127.0.0.1'
104-
if (this.serverOptions.type === 'websocket' && this.serverOptions.port === 0) {
105-
// When the configured port i 0, the next free port is picked
106-
url += `:${this.manager.expectationManagerServer.websocketServer?.port}`
107-
}
108103
this._serverAccessUrls = {
109-
'*': url,
104+
'*': 'ws://127.0.0.1',
105+
}
106+
}
107+
this.logger.info(`##### type: ${this.workForceConnectionOptions.type}`)
108+
if (this.serverOptions.type === 'websocket' && this.serverOptions.port === 0) {
109+
this.logger.info(`##### this.serverOptions.port: ${this.serverOptions.port}`)
110+
// When the configured port i 0, the next free port is picked
111+
for (const key of Object.keys(this._serverAccessUrls)) {
112+
// If no port was specified in the url, add it:
113+
if (!this._serverAccessUrls[key].match(/\/\/[^/]+:\d/)) {
114+
this.logger.info(`updateing ${key}`)
115+
this._serverAccessUrls[key] += `:${this.manager.expectationManagerServer.websocketServer?.port}`
116+
}
110117
}
111118
}
119+
120+
this.logger.info(`##### this.serverAccessBaseUrls: ${JSON.stringify(this.serverAccessBaseUrls)}`)
121+
this.logger.info(`##### websocketServer?.port: ${this.manager.expectationManagerServer.websocketServer?.port}`)
122+
this.logger.info(`##### this._serverAccessUrls: ${JSON.stringify(this._serverAccessUrls)}`)
123+
112124
if (!this._serverAccessUrls) throw new Error(`ExpectationManager.serverAccessUrl not set!`)
113125
}
114126
terminate(): void {

0 commit comments

Comments
 (0)