Skip to content

Commit ceae75d

Browse files
committed
Define default HTTP Client timeout
1 parent e59d448 commit ceae75d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ interface ConfigConstructor {
1111
terminalApiLocalEndpoint?: string;
1212
}
1313

14+
const DEFAULT_TIMEOUT = 30000; // Default timeout value (30 sec)
15+
1416
class Config {
1517
public username?: string;
1618
public password?: string;
@@ -31,7 +33,8 @@ class Config {
3133
if (options.marketPayEndpoint) this.marketPayEndpoint = options.marketPayEndpoint;
3234
if (options.applicationName) this.applicationName = options.applicationName;
3335
if (options.apiKey) this.apiKey = options.apiKey;
34-
if (options.connectionTimeoutMillis) this.connectionTimeoutMillis = options.connectionTimeoutMillis || 30000;
36+
// Set the timeout to DEFAULT_TIMEOUT if not provided
37+
this.connectionTimeoutMillis = options.connectionTimeoutMillis ?? DEFAULT_TIMEOUT;
3538
if (options.certificatePath) this.certificatePath = options.certificatePath;
3639
if (options.terminalApiCloudEndpoint) this.terminalApiCloudEndpoint = options.terminalApiCloudEndpoint;
3740
if (options.terminalApiLocalEndpoint) this.terminalApiLocalEndpoint = options.terminalApiLocalEndpoint;

0 commit comments

Comments
 (0)