attlaz-client 1.19.4 → 1.19.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,10 @@ export declare class OAuthClient {
22
22
  enableDebug(): void;
23
23
  disableDebug(): void;
24
24
  isDebugEnabled(): boolean;
25
+ private defaultHeaders;
25
26
  getDefaultHeaders(): Headers;
27
+ private initDefaultHeaders;
28
+ addDefaultHeader(header: string, value: string): void;
26
29
  private isNodeEnvironment;
27
30
  private tokenToOauthClientToken;
28
31
  private getApiEndpointUrl;
@@ -14,6 +14,7 @@ export class OAuthClient {
14
14
  refreshTokenPromise = null;
15
15
  constructor(options) {
16
16
  this.options = options;
17
+ this.initDefaultHeaders();
17
18
  }
18
19
  async authenticate(username = null, password = null) {
19
20
  // TODO: should we encrypt the password in the client (or is https save enough)?
@@ -104,7 +105,7 @@ export class OAuthClient {
104
105
  }
105
106
  const requestData = this.createRequestData(action, parameters, method, signWithOauthToken);
106
107
  if (this.debug) {
107
- console.debug('[OAuthClient] Request: ' + requestData.method.toUpperCase() + ' ' + requestData.getFullUrl());
108
+ console.debug('[OAuthClient] Request: ' + requestData.method.toUpperCase() + ' ' + requestData.getFullUrl(), { headers: requestData.headers });
108
109
  }
109
110
  try {
110
111
  const response = await HttpClient.request(requestData);
@@ -150,7 +151,11 @@ export class OAuthClient {
150
151
  isDebugEnabled() {
151
152
  return this.debug;
152
153
  }
154
+ defaultHeaders = {};
153
155
  getDefaultHeaders() {
156
+ return this.defaultHeaders;
157
+ }
158
+ initDefaultHeaders() {
154
159
  const userAgentInfo = {
155
160
  version: VERSION,
156
161
  language: 'Javascript',
@@ -161,7 +166,10 @@ export class OAuthClient {
161
166
  if (this.isNodeEnvironment()) {
162
167
  headers['User-Agent'] = 'Attlaz Http/' + VERSION;
163
168
  }
164
- return headers;
169
+ this.defaultHeaders = headers;
170
+ }
171
+ addDefaultHeader(header, value) {
172
+ this.defaultHeaders[header] = value;
165
173
  }
166
174
  isNodeEnvironment() {
167
175
  return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.19.1";
1
+ export declare const VERSION = "1.19.5";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.19.1";
1
+ export const VERSION = "1.19.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.19.4",
3
+ "version": "1.19.6",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",