Skip to content

Commit

Permalink
Orbidder: fix getting the end point url for developoment and integrat…
Browse files Browse the repository at this point in the history
…ion tests from local storage (#5463)

* orbidder adapter: add withCredentials:true header to BidRequest and onBidWon Requests

* add blank in order to trigger build again

* remove blank to trigger build ... again

* adding extra line to trigger build ... again

* add prebid version to request

* add unit test for version parameter

* add version parameter to win requests

* fix comment

* trigger rebuild

* trigger rebuild

* remove onBidWon callback from adapter

* fix retrieving orbidder endpoint url from local storage

* fix unit tests

Co-authored-by: Volk, Rainer <[email protected]>
Co-authored-by: RainerVolk4014 <[email protected]>
Co-authored-by: siggi-otto <[email protected]>
Co-authored-by: Hendrik Iseke <[email protected]>
Co-authored-by: Hendrik Iseke <[email protected]>
Co-authored-by: rvolk <>
  • Loading branch information
6 people authored Aug 10, 2020
1 parent 96af098 commit 7d24bb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 9 additions & 6 deletions modules/orbidderBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';

const storage = getStorageManager();
const storageManager = getStorageManager();

export const spec = {
code: 'orbidder',
orbidderHost: (() => {
let ret = 'https://orbidder.otto.de';
hostname: 'https://orbidder.otto.de',

getHostname() {
let ret = this.hostname;
try {
ret = storage.getDataFromLocalStorage('ov_orbidder_host') || ret;
ret = storageManager.getDataFromLocalStorage('ov_orbidder_host') || ret;
} catch (e) {
}
return ret;
})(),
},

isBidRequestValid(bid) {
return !!(bid.sizes && bid.bidId && bid.params &&
Expand All @@ -23,14 +25,15 @@ export const spec = {
},

buildRequests(validBidRequests, bidderRequest) {
const hostname = this.getHostname();
return validBidRequests.map((bidRequest) => {
let referer = '';
if (bidderRequest && bidderRequest.refererInfo) {
referer = bidderRequest.refererInfo.referer || '';
}

const ret = {
url: `${spec.orbidderHost}/bid`,
url: `${hostname}/bid`,
method: 'POST',
options: { withCredentials: true },
data: {
Expand Down
4 changes: 1 addition & 3 deletions test/spec/modules/orbidderBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {expect} from 'chai';
import {spec} from 'modules/orbidderBidAdapter.js';
import {newBidder} from 'src/adapters/bidderFactory.js';
import openxAdapter from '../../../modules/openxAnalyticsAdapter.js';
import {detectReferer} from 'src/refererDetection.js';

describe('orbidderBidAdapter', () => {
const adapter = newBidder(spec);
Expand Down Expand Up @@ -93,7 +91,7 @@ describe('orbidderBidAdapter', () => {
it('sends bid request to endpoint via https using post', () => {
expect(request.method).to.equal('POST');
expect(request.url.indexOf('https://')).to.equal(0);
expect(request.url).to.equal(`${spec.orbidderHost}/bid`);
expect(request.url).to.equal(`${spec.hostname}/bid`);
});

it('contains prebid version parameter', () => {
Expand Down

0 comments on commit 7d24bb8

Please sign in to comment.