Skip to content

Commit

Permalink
appnexusBidAdapter - add support for test flag (#6119)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnellbaker authored Dec 14, 2020
1 parent a2454a5 commit 94c9dcc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,12 @@ function formatRequest(payload, bidderRequest) {
}
}

if (utils.getParameterByName('apn_test').toUpperCase() === 'TRUE' || config.getConfig('apn_test') === true) {
options.customHeaders = {
'X-Is-Test': 1
}
}

if (payload.tags.length > MAX_IMPS_PER_REQUEST) {
const clonedPayload = utils.deepClone(payload);

Expand Down
12 changes: 12 additions & 0 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,18 @@ describe('AppNexusAdapter', function () {
config.getConfig.restore();
});

it('should set the X-Is-Test customHeader if test flag is enabled', function () {
let bidRequest = Object.assign({}, bidRequests[0]);
sinon.stub(config, 'getConfig')
.withArgs('apn_test')
.returns(true);

const request = spec.buildRequests([bidRequest]);
expect(request.options.customHeaders).to.deep.equal({'X-Is-Test': 1});

config.getConfig.restore();
});

it('should set withCredentials to false if purpose 1 consent is not given', function () {
let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
let bidderRequest = {
Expand Down

0 comments on commit 94c9dcc

Please sign in to comment.