Skip to content

Commit

Permalink
fix: channelName and address
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Oct 2, 2023
1 parent e1c12f5 commit ddd88f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/adapters/http/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class HttpClientAdapter extends Adapter {
let headers = {}
const authConfig = await clientAuthConfig(this.serverName)
const serverUrl = this.serverUrlExpanded

Check warning on line 25 in src/adapters/http/client.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

'serverUrl' is assigned a value but never used

Check warning on line 25 in src/adapters/http/client.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - macos-latest

'serverUrl' is assigned a value but never used
for (const channelName of this.channelNames) {
for (const channelName of this.channelAddresses) {
const channelInfo = this.parsedAsyncAPI.channels().get(channelName)
const httpChannelBinding = channelInfo.bindings().get('http')
const channelServers = channelInfo.servers().all().map(e => e.id())
const isChannelServers =
!channelServers.length || channelServers.includes(message.serverName)
if (httpChannelBinding && isChannelServers) {
const method = httpChannelBinding.json().method
let url = `${serverUrl}/${channelName}`
let url = new URL(this.AsyncAPIServer.url() + this.parsedAsyncAPI.channels().get(channelName).address())
const gleeAuth = new GleeAuth(
this.AsyncAPIServer,
this.parsedAsyncAPI,
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/ws/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class WsClientAdapter extends Adapter {
this.serverName,
authConfig
)
let url = new URL(this.AsyncAPIServer.url() + channel)
let url = new URL(this.AsyncAPIServer.url() + this.parsedAsyncAPI.channels().get(channel).address())
if (authConfig) {
const modedAuth = await gleeAuth.processClientAuth(url, headers, {})
headers = modedAuth.headers
Expand Down
2 changes: 1 addition & 1 deletion src/lib/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GleeAdapter extends EventEmitter {
this._AsyncAPIServer = server

this._parsedAsyncAPI = parsedAsyncAPI
this._channelNames = this._parsedAsyncAPI.channels().all().map(e => e.address())
this._channelNames = this._parsedAsyncAPI.channels().all().map(e => e.id())
this._channelAddresses = this._parsedAsyncAPI.channels().all().map(c => c.address())
this._connections = []

Expand Down

0 comments on commit ddd88f3

Please sign in to comment.