Skip to content

Commit

Permalink
enforce video.size_id for video imps in rubicon adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Aadesh Patel committed Nov 12, 2019
1 parent 5599d8f commit 8f619ff
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
12 changes: 10 additions & 2 deletions adapters/rubicon/rubicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -683,6 +684,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[...].ext.bidder.rubicon.video.size_id must be defined for video impression #%d", 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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[...].ext.bidder.rubicon.video.size_id must be defined for video impression #0",
"comparison": "literal"
}
]
}

0 comments on commit 8f619ff

Please sign in to comment.