Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed cache path and cache host #10

Merged
merged 1 commit into from
Mar 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/creative.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import * as environment from './environment';

const pbjs = window.pbjs = (window.pbjs || {});
const GOOGLE_IFRAME_HOSTNAME = '//tpc.googlesyndication.com';
const DEFAULT_CACHE_HOST = 'prebid.adnxs.com';
const DEFAULT_CACHE_PATH = '/pbc/v1/cache';

/**
* DataObject passed to render the ad
Expand Down Expand Up @@ -118,8 +120,14 @@ function renderCrossDomain(adId, pubUrl) {
requestAdFromPrebid();
}

function renderAmpAd(cacheHost = 'prebid.adnxs.com', cachePath = '/pbc/v1/cache', uuid) {
let adUrl = `https://${cacheHost}${cachePath}?uuid=${uuid}`;
function getCacheEndpoint(cacheHost, cachePath) {
let host = (typeof cacheHost === 'undefined' || cacheHost === "") ? DEFAULT_CACHE_HOST : cacheHost;
let path = (typeof cachePath === 'undefined' || cachePath === "") ? DEFAULT_CACHE_PATH : cachePath;
return `https://${host}${path}`;
}

function renderAmpAd(cacheHost, cachePath, uuid) {
let adUrl = `${getCacheEndpoint(cacheHost, cachePath)}?uuid=${uuid}`;

let handler = function(response) {
let bidObject;
Expand Down