Constructor
new ServerClientConfig(endpointopt)
Server client configuration constructor.
Sets configuration default value to
timeout
and keepAlive
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
endpoint |
string |
<optional> |
Endpoint url. |
- Source:
Extends
Methods
disableAuthentication()
Disables authentication.
- Overrides:
- Source:
getBasicAuthentication() → {boolean}
- Overrides:
- Source:
Returns:
[basicAuth] if use Basic Auth
- Type
- boolean
getEndpoint() → {string}
Returns the server's endpoint URL.
- Overrides:
- Source:
Returns:
the endpoint URL
- Type
- string
getGdbTokenAuthentication() → {boolean}
- Overrides:
- Source:
Returns:
[gdbTokenAuth] if use Gdb Token Auth
- Type
- boolean
getHeaders() → {Object.<string, string>}
Returns the default headers for each HTTP request.
- Overrides:
- Source:
Returns:
the default headers map
- Type
- Object.<string, string>
getKeepAlive() → {boolean}
- Overrides:
- Source:
Returns:
if the user should be re-logged in after token expires
- Type
- boolean
getPass() → {string}
- Overrides:
- Source:
Returns:
the user password
- Type
- string
getTimeout() → {number}
Returns the HTTP requests's timeout.
- Source:
Returns:
the timeout in milliseconds
- Type
- number
getUsername() → {string}
- Overrides:
- Source:
Returns:
the username
- Type
- string
setEndpoint(endpoint) → {this}
Sets the server's endpoint URL.
Parameters:
Name | Type | Description |
---|---|---|
endpoint |
string | the endpoint URL |
- Overrides:
- Source:
Returns:
the current config for method chaining
- Type
- this
setHeaders(headers) → {this}
Sets the default headers map for each HTTP request.
Parameters:
Name | Type | Description |
---|---|---|
headers |
Object.<string, string> | the default headers |
- Overrides:
- Source:
Returns:
the concrete configuration config for method chaining
- Type
- this
setKeepAlive(keepAlive) → {this}
Parameters:
Name | Type | Description |
---|---|---|
keepAlive |
boolean |
- Overrides:
- Source:
Returns:
the concrete configuration config for method chaining
- Type
- this
setTimeout(timeout) → {this}
Sets the timeout for HTTP requests.
Parameters:
Name | Type | Description |
---|---|---|
timeout |
number | the timeout in milliseconds before the request times out. |
- Source:
Returns:
the concrete configuration config for method chaining
- Type
- this
shouldAuthenticate() → {boolean}
Returns true
if basic or gdb token authentication
is enabled. false
otherwise.
- Overrides:
- Source:
Returns:
is authentication enabled
- Type
- boolean
useBasicAuthentication(usernameopt, passopt) → {this}
Username and password for user logging setter. Sets basic authentication as client authentication type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
username |
string |
<optional> |
|
pass |
string |
<optional> |
- Overrides:
- Source:
Returns:
the concrete configuration config for method chaining
- Type
- this
useGdbTokenAuthentication(usernameopt, passopt) → {this}
Username and password for user logging setter. Sets gdb token authentication as client authentication type. *
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
username |
string |
<optional> |
|
pass |
string |
<optional> |
- Overrides:
- Source:
Returns:
the concrete configuration config for method chaining
- Type
- this