Skip to content

Commit

Permalink
[sc-50473] Handled cases where undefined 'X-Kevel-ApiKey' being sen…
Browse files Browse the repository at this point in the history
…t as undefined.
  • Loading branch information
Simon Ramzi committed Sep 28, 2023
1 parent f236738 commit 2e8ddc2
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ class DecisionClient {
logger(
'warn',
'--------------------------------------------------------------\n' +
'--------------!!! WARNING - WARNING - WARNING !!!-------------\n' +
'' +
'You have opted to include explainer details with this request!\n' +
'This will cause performance degradation and should not be done\n' +
'in production environments.\n' +
'--------------------------------------------------------------'
'--------------!!! WARNING - WARNING - WARNING !!!-------------\n' +
'' +
'You have opted to include explainer details with this request!\n' +
'This will cause performance degradation and should not be done\n' +
'in production environments.\n' +
'--------------------------------------------------------------'
);

if (additionalOpts.desiredAds) {
Expand Down Expand Up @@ -331,13 +331,21 @@ class PixelClient {
additionalOpts?: AdditionalOptions
): Promise<PixelFireResponse> {
let logger = this._logger || defaultLogger;

let headersbase = {
'X-Adzerk-Sdk-Version': this._versionString,
'User-Agent': additionalOpts?.userAgent || 'OpenAPI-Generator/1.0/js',
};
let headers = additionalOpts?.apiKey ?
{
...headersbase,
'X-Kevel-ApiKey': additionalOpts.apiKey,
} :
headersbase;

let opts: any = {
method: 'GET',
headers: {
'X-Adzerk-Sdk-Version': this._versionString,
'X-Kevel-ApiKey': additionalOpts?.apiKey,
'User-Agent': additionalOpts?.userAgent || 'OpenAPI-Generator/1.0/js',
},
headers,
redirect: 'manual',
};

Expand Down

0 comments on commit 2e8ddc2

Please sign in to comment.