diff --git a/src/models.ts b/src/models.ts index 6bb276a..6c99176 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,3 +1,7 @@ +interface IHeaders { + [header: string]: string; +} + interface IConfig { baseUrl: string; key: string; @@ -6,6 +10,7 @@ interface IConfig { password: string; tokenRequest: any; accessToken: string; + defaultHeaders: IHeaders; } export interface ITrustpilotApiConfig extends Partial {} diff --git a/src/request-helper.ts b/src/request-helper.ts index 29ed0f0..16f1490 100644 --- a/src/request-helper.ts +++ b/src/request-helper.ts @@ -6,8 +6,11 @@ export class RequestHelper { constructor(private accessProvider: AccessProvider) {} get basicRequest() { + const headers = this.accessProvider.trustpilotApiConfig.defaultHeaders || {}; + return rp.defaults({ baseUrl: this.accessProvider.trustpilotApiConfig.baseUrl, + headers, json: true, }); }