diff --git a/adapters/rubicon/rubicon.go b/adapters/rubicon/rubicon.go index 7f8de46bcfe..e7461c48f7e 100644 --- a/adapters/rubicon/rubicon.go +++ b/adapters/rubicon/rubicon.go @@ -5,13 +5,14 @@ import ( "context" "encoding/json" "fmt" - "github.com/golang/glog" - "github.com/prebid/prebid-server/pbs" "io/ioutil" "net/http" "net/url" "strings" + "github.com/golang/glog" + "github.com/prebid/prebid-server/pbs" + "golang.org/x/net/context/ctxhttp" "github.com/mxmCherry/openrtb" @@ -685,6 +686,13 @@ func (a *RubiconAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adap isVideo := isVideo(thisImp) if isVideo { + if rubiconExt.Video.VideoSizeID == 0 { + errs = append(errs, &errortypes.BadInput{ + Message: fmt.Sprintf("imp[%d].ext.bidder.rubicon.video.size_id must be defined for video impression", i), + }) + continue + } + videoCopy := *thisImp.Video videoExt := rubiconVideoExt{Skip: rubiconExt.Video.Skip, SkipDelay: rubiconExt.Video.SkipDelay, RP: rubiconVideoExtRP{SizeID: rubiconExt.Video.VideoSizeID}} videoCopy.Ext, err = json.Marshal(&videoExt) diff --git a/adapters/rubicon/rubicon_test.go b/adapters/rubicon/rubicon_test.go index bc3d2e8ae9e..dd9cea62bc7 100644 --- a/adapters/rubicon/rubicon_test.go +++ b/adapters/rubicon/rubicon_test.go @@ -1244,8 +1244,9 @@ func TestOpenRTBRequestWithVideoImpEvenIfImpHasBannerButAllRequiredVideoFields(t "zoneId": 8394, "siteId": 283282, "accountId": 7891, - "inventory": {"key1" : "val1"}, - "visitor": {"key2" : "val2"} + "inventory": {"key1": "val1"}, + "visitor": {"key2": "val2"}, + "video": {"size_id": 1} }}`), }}, } diff --git a/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json b/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json new file mode 100644 index 00000000000..cf0a594e13c --- /dev/null +++ b/adapters/rubicon/rubicontest/supplemental/required-video-size-id.json @@ -0,0 +1,31 @@ +{ + "mockBidRequest": { + "id": "test-req-id", + "imp": [ + { + "id": "test-imp-1", + "video": { + "w": 640, + "h": 480, + "linearity": 1 + }, + "ext": { + "bidder": { + "accountId": 1001, + "siteId":113932, + "zoneId":535510 + } + } + } + ], + "site": { + "page": "prebid.org" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "imp[0].ext.bidder.rubicon.video.size_id must be defined for video impression", + "comparison": "literal" + } + ] +}