Skip to content

Commit d54ca64

Browse files
committed
more robust code
1 parent 6f43105 commit d54ca64

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/auth/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ export class Authenticator {
2626
private rwlock = new ReadWriteLock();
2727

2828
constructor(context: Context, options: ConnectionOptions) {
29+
context.httpClient.authenticator = this;
2930
this.context = context;
3031
this.options = options;
31-
if (context.httpClient.authenticator) {
32-
return context.httpClient.authenticator;
33-
} else {
34-
context.httpClient.authenticator = this;
35-
}
3632
}
3733

3834
private getCacheKey(): TokenKey | undefined {

src/core/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export class FireboltCore {
1616

1717
async connect(connectionOptions: ConnectionOptions) {
1818
// Create a new httpClient instance for each connection
19-
const httpClient = new NodeHttpClient();
19+
const httpClient =
20+
this.options.dependencies?.httpClient || new NodeHttpClient();
2021

2122
// Create a new context with the new httpClient
2223
const connectionContext = {
@@ -38,7 +39,8 @@ export class FireboltCore {
3839

3940
async testConnection(connectionOptions: ConnectionOptions) {
4041
// Create a new httpClient instance for test connection too
41-
const httpClient = new NodeHttpClient();
42+
const httpClient =
43+
this.options.dependencies?.httpClient || new NodeHttpClient();
4244

4345
// Create a new context with the new httpClient
4446
const connectionContext = {

0 commit comments

Comments
 (0)