diff --git a/src/index.ts b/src/index.ts index cd9f456..2aff56c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,8 +62,9 @@ export class Redmine { } }; - const { apiKey, username, password } = this.options; + const { apiKey, username, password, impersonateUser } = this.options; + // Set authentication if (apiKey) { connConfig.headers['X-Redmine-API-Key'] = apiKey; } @@ -74,6 +75,11 @@ export class Redmine { }; } + // Set impersonate + if (impersonateUser) { + connConfig.headers['X-Redmine-Switch-User'] = impersonateUser; + } + this.conn = axios.create(connConfig); } @@ -991,6 +997,7 @@ export namespace RedmineTS { apiKey?: string; username?: string; password?: string; + impersonateUser?: string; maxUploadSize?: number; // Default: 5MB }