Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.

Commit 6789104

Browse files
VeronikaSolovei9guscarreon
authored andcommitted
Added pass through of BCat and BAdv from Video req to openRTB request (prebid#964)
1 parent 37cea94 commit 6789104

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

endpoints/openrtb2/video_auction.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,14 @@ func mergeData(videoRequest *openrtb_ext.BidRequestVideo, bidRequest *openrtb.Bi
467467
}
468468
}
469469

470+
if len(videoRequest.BCat) != 0 {
471+
bidRequest.BCat = videoRequest.BCat
472+
}
473+
474+
if len(videoRequest.BAdv) != 0 {
475+
bidRequest.BAdv = videoRequest.BAdv
476+
}
477+
470478
bidExt, err := createBidExtension(videoRequest)
471479
if err != nil {
472480
return err

endpoints/openrtb2/video_auction_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,43 @@ func TestVideoBuildVideoResponseNoBids(t *testing.T) {
487487
assert.Len(t, bidRespVideo.AdPods, 0, "AdPods length should be 0")
488488
}
489489

490+
func TestMergeOpenRTBToVideoRequest(t *testing.T) {
491+
var bidReq = &openrtb.BidRequest{}
492+
var videoReq = &openrtb_ext.BidRequestVideo{}
493+
494+
videoReq.App = openrtb.App{
495+
Domain: "test.com",
496+
Bundle: "test.bundle",
497+
}
498+
499+
videoReq.Site = openrtb.Site{
500+
Page: "site.com/index",
501+
}
502+
503+
var dnt int8 = 4
504+
var lmt int8 = 5
505+
videoReq.Device = openrtb.Device{
506+
DNT: &dnt,
507+
Lmt: &lmt,
508+
}
509+
510+
videoReq.BCat = []string{"test1", "test2"}
511+
videoReq.BAdv = []string{"test3", "test4"}
512+
513+
mergeData(videoReq, bidReq)
514+
515+
assert.Equal(t, videoReq.BCat, bidReq.BCat, "BCat is incorrect")
516+
assert.Equal(t, videoReq.BAdv, bidReq.BAdv, "BAdv is incorrect")
517+
518+
assert.Equal(t, videoReq.App.Domain, bidReq.App.Domain, "App.Domain is incorrect")
519+
assert.Equal(t, videoReq.App.Bundle, bidReq.App.Bundle, "App.Bundle is incorrect")
520+
521+
assert.Equal(t, videoReq.Device.Lmt, bidReq.Device.Lmt, "Device.Lmt is incorrect")
522+
assert.Equal(t, videoReq.Device.DNT, bidReq.Device.DNT, "Device.DNT is incorrect")
523+
524+
assert.Equal(t, videoReq.Site.Page, bidReq.Site.Page, "Device.Site.Page is incorrect")
525+
}
526+
490527
func mockDeps(t *testing.T, ex *mockExchangeVideo) *endpointDeps {
491528
theMetrics := pbsmetrics.NewMetrics(metrics.NewRegistry(), openrtb_ext.BidderList())
492529
edep := &endpointDeps{

openrtb_ext/bid_request_video.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ type BidRequestVideo struct {
111111
// be received including Internet latency to avoid timeout. This
112112
// value supersedes any a priori guidance from the exchange.
113113
TMax int64 `json:"tmax,omitempty"`
114+
115+
// Attribute:
116+
// bcat
117+
// Type:
118+
// string array
119+
// Description:
120+
// Blocked advertiser categories using the IAB content
121+
// categories. Refer to List 5.1.
122+
BCat []string `json:"bcat,omitempty"`
123+
124+
// Attribute:
125+
// badv
126+
// Type:
127+
// string array
128+
// Description:
129+
// Block list of advertisers by their domains (e.g., “ford.com”).
130+
BAdv []string `json:"badv,omitempty"`
114131
}
115132

116133
type PodConfig struct {

0 commit comments

Comments
 (0)