diff --git a/endpoints/auction.go b/endpoints/auction.go index 563273f9401..6808725e283 100644 --- a/endpoints/auction.go +++ b/endpoints/auction.go @@ -440,13 +440,13 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr hbPbBidderKey := string(openrtb_ext.HbpbConstantKey) + "_" + bid.BidderCode hbBidderBidderKey := string(openrtb_ext.HbBidderConstantKey) + "_" + bid.BidderCode - hbCacheIDBidderKey := string(openrtb_ext.HbCacheKey) + "_" + bid.BidderCode - hbDealIDBidderKey := string(openrtb_ext.HbDealIdConstantKey) + "_" + bid.BidderCode + HbCacheIDBidderKey := string(openrtb_ext.HbCacheKey) + "_" + bid.BidderCode + hbDealIDBidderKey := string(openrtb_ext.HbDealIDConstantKey) + "_" + bid.BidderCode hbSizeBidderKey := string(openrtb_ext.HbSizeConstantKey) + "_" + bid.BidderCode if pbs_req.MaxKeyLength != 0 { hbPbBidderKey = hbPbBidderKey[:min(len(hbPbBidderKey), int(pbs_req.MaxKeyLength))] hbBidderBidderKey = hbBidderBidderKey[:min(len(hbBidderBidderKey), int(pbs_req.MaxKeyLength))] - hbCacheIDBidderKey = hbCacheIDBidderKey[:min(len(hbCacheIDBidderKey), int(pbs_req.MaxKeyLength))] + HbCacheIDBidderKey = HbCacheIDBidderKey[:min(len(HbCacheIDBidderKey), int(pbs_req.MaxKeyLength))] hbDealIDBidderKey = hbDealIDBidderKey[:min(len(hbDealIDBidderKey), int(pbs_req.MaxKeyLength))] hbSizeBidderKey = hbSizeBidderKey[:min(len(hbSizeBidderKey), int(pbs_req.MaxKeyLength))] } @@ -459,7 +459,7 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr kvs[hbPbBidderKey] = roundedCpm kvs[hbBidderBidderKey] = bid.BidderCode - kvs[hbCacheIDBidderKey] = bid.CacheID + kvs[HbCacheIDBidderKey] = bid.CacheID if hbSize != "" { kvs[hbSizeBidderKey] = hbSize @@ -473,7 +473,7 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr kvs[string(openrtb_ext.HbBidderConstantKey)] = bid.BidderCode kvs[string(openrtb_ext.HbCacheKey)] = bid.CacheID if bid.DealId != "" { - kvs[string(openrtb_ext.HbDealIdConstantKey)] = bid.DealId + kvs[string(openrtb_ext.HbDealIDConstantKey)] = bid.DealId } if hbSize != "" { kvs[string(openrtb_ext.HbSizeConstantKey)] = hbSize diff --git a/endpoints/auction_test.go b/endpoints/auction_test.go index 8b4c6aad6ff..2abee138b88 100644 --- a/endpoints/auction_test.go +++ b/endpoints/auction_test.go @@ -161,8 +161,8 @@ func TestSortBidsAndAddKeywordsForMobile(t *testing.T) { if bid.AdServerTargeting[string(openrtb_ext.HbBidderConstantKey)] != "audienceNetwork" { t.Error(string(openrtb_ext.HbBidderConstantKey) + " key was not parsed correctly") } - if bid.AdServerTargeting[string(openrtb_ext.HbDealIdConstantKey)] != "2345" { - t.Error(string(openrtb_ext.HbDealIdConstantKey) + " key was not parsed correctly ") + if bid.AdServerTargeting[string(openrtb_ext.HbDealIDConstantKey)] != "2345" { + t.Error(string(openrtb_ext.HbDealIDConstantKey) + " key was not parsed correctly ") } } if bid.BidderCode == "appnexus" { @@ -181,8 +181,8 @@ func TestSortBidsAndAddKeywordsForMobile(t *testing.T) { if bid.AdServerTargeting[string(openrtb_ext.HbpbConstantKey)] != "" { t.Error(string(openrtb_ext.HbpbConstantKey) + " key was parsed for two bidders") } - if bid.AdServerTargeting[string(openrtb_ext.HbDealIdConstantKey)+"_appnexus"] != "1234" { - t.Errorf(string(openrtb_ext.HbDealIdConstantKey)+"_appnexus was not parsed correctly %v", bid.AdServerTargeting[string(openrtb_ext.HbDealIdConstantKey)+"_appnexus"]) + if bid.AdServerTargeting[string(openrtb_ext.HbDealIDConstantKey)+"_appnexus"] != "1234" { + t.Errorf(string(openrtb_ext.HbDealIDConstantKey)+"_appnexus was not parsed correctly %v", bid.AdServerTargeting[string(openrtb_ext.HbDealIDConstantKey)+"_appnexus"]) } } if bid.BidderCode == string(openrtb_ext.BidderRubicon) { @@ -196,8 +196,8 @@ func TestSortBidsAndAddKeywordsForMobile(t *testing.T) { } } if bid.BidderCode == "nodeal" { - if _, exists := bid.AdServerTargeting[string(openrtb_ext.HbDealIdConstantKey)+"_nodeal"]; exists { - t.Error(string(openrtb_ext.HbDealIdConstantKey) + " key for nodeal bidder was not parsed correctly") + if _, exists := bid.AdServerTargeting[string(openrtb_ext.HbDealIDConstantKey)+"_nodeal"]; exists { + t.Error(string(openrtb_ext.HbDealIDConstantKey) + " key for nodeal bidder was not parsed correctly") } } } diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index e73274bebfb..0e987fcc636 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -377,7 +377,7 @@ func buildVideoResponse(bidresponse *openrtb.BidResponse, podErrors []PodError) videoTargeting := openrtb_ext.VideoTargeting{ HbPb: tempRespBidExt.Prebid.Targeting[string(openrtb_ext.HbpbConstantKey)], HbPbCatDur: tempRespBidExt.Prebid.Targeting[string(openrtb_ext.HbCategoryDurationKey)], - HbCacheId: tempRespBidExt.Prebid.Targeting[string(openrtb_ext.HbVastCacheKey)], + HbCacheID: tempRespBidExt.Prebid.Targeting[string(openrtb_ext.HbVastCacheKey)], } adPod := findAdPod(podId, adPods) diff --git a/exchange/auction.go b/exchange/auction.go index 2b9a8cb58fc..58c99fe1fdb 100644 --- a/exchange/auction.go +++ b/exchange/auction.go @@ -73,11 +73,11 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, toCache := make([]prebid_cache_client.Cacheable, 0, expectNumBids+expectNumVast) expByImp := make(map[string]int64) competitiveExclusion := false - var hbCacheID string + var HbCacheID string if len(bidCategory) > 0 { // assert: category of winning bids never duplicated if rawUuid, err := uuid.NewV4(); err == nil { - hbCacheID = rawUuid.String() + HbCacheID = rawUuid.String() competitiveExclusion = true } else { errs = append(errs, errors.New("failed to create custom cache key")) @@ -102,7 +102,7 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, // set custom cache key for winning bid when competitive exclusion applies catDur = bidCategory[topBidPerBidder.bid.ID] if len(catDur) > 0 { - customCacheKey = fmt.Sprintf("%s_%s", catDur, hbCacheID) + customCacheKey = fmt.Sprintf("%s_%s", catDur, HbCacheID) useCustomCacheKey = true } } @@ -164,9 +164,9 @@ func (a *auction) doCache(ctx context.Context, cache prebid_cache_client.Client, a.vastCacheIds = make(map[*openrtb.Bid]string, len(vastIndices)) for index, bid := range vastIndices { if ids[index] != "" { - if competitiveExclusion && strings.HasSuffix(ids[index], hbCacheID) { + if competitiveExclusion && strings.HasSuffix(ids[index], HbCacheID) { // omit the pb_cat_dur_ portion of cache ID - a.vastCacheIds[bid] = hbCacheID + a.vastCacheIds[bid] = HbCacheID } else { a.vastCacheIds[bid] = ids[index] } diff --git a/exchange/targeting.go b/exchange/targeting.go index 66efa5f49c0..560f62dcfb3 100644 --- a/exchange/targeting.go +++ b/exchange/targeting.go @@ -51,7 +51,7 @@ func (targData *targetData) setTargeting(auc *auction, isApp bool, categoryMappi targData.addKeys(targets, openrtb_ext.HbVastCacheKey, vastID, bidderName, isOverallWinner) } if deal := topBidPerBidder.bid.DealID; len(deal) > 0 { - targData.addKeys(targets, openrtb_ext.HbDealIdConstantKey, deal, bidderName, isOverallWinner) + targData.addKeys(targets, openrtb_ext.HbDealIDConstantKey, deal, bidderName, isOverallWinner) } if isApp { diff --git a/openrtb_ext/bid.go b/openrtb_ext/bid.go index fc67a932fe0..f44d2320e2f 100644 --- a/openrtb_ext/bid.go +++ b/openrtb_ext/bid.go @@ -87,7 +87,7 @@ const ( // HbBidderConstantKey is the name of the Bidder. For example, "appnexus" or "rubicon". HbBidderConstantKey TargetingKey = "hb_bidder" HbSizeConstantKey TargetingKey = "hb_size" - HbDealIdConstantKey TargetingKey = "hb_deal" + HbDealIDConstantKey TargetingKey = "hb_deal" // HbCacheKey and HbVastCacheKey store UUIDs which can be used to fetch things from prebid cache. // Callers should *never* assume that either of these exist, since the call to the cache may always fail. diff --git a/openrtb_ext/bid_response_video.go b/openrtb_ext/bid_response_video.go index db8861d703f..058d06c30f9 100644 --- a/openrtb_ext/bid_response_video.go +++ b/openrtb_ext/bid_response_video.go @@ -16,5 +16,5 @@ type AdPod struct { type VideoTargeting struct { HbPb string `json:"hb_pb"` HbPbCatDur string `json:"hb_pb_cat_dur"` - HbCacheId string `json:"hb_cache_id"` + HbCacheID string `json:"hb_cache_id"` }