Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rubicon: bid.ext.prebid.meta returns as it is #3949

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 41 additions & 1 deletion adapters/rubicon/rubicon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ func TestOpenRTBResponseSettingOfNetworkId(t *testing.T) {

var givenBidExt json.RawMessage
if scenario.bidExt != nil {
marshalledExt, _ := json.Marshal(scenario.bidExt)
marshalledExt, _ := json.Marshal(&openrtb_ext.ExtBid{Prebid: scenario.bidExt})
givenBidExt = marshalledExt
} else {
givenBidExt = nil
Expand Down Expand Up @@ -1041,6 +1041,46 @@ func TestOpenRTBResponseSettingOfNetworkId(t *testing.T) {
}
}

func TestOpenRTBResponseBidExtPrebidMetaPassthrough(t *testing.T) {
request := &openrtb2.BidRequest{
Imp: []openrtb2.Imp{{
ID: "test-imp-id",
Banner: &openrtb2.Banner{},
}},
}

requestJson, _ := json.Marshal(request)
reqData := &adapters.RequestData{
Method: "POST",
Uri: "test-uri",
Body: requestJson,
Headers: nil,
}

bidExt := &openrtb_ext.ExtBid{Prebid: &openrtb_ext.ExtBidPrebid{Meta: &openrtb_ext.ExtBidPrebidMeta{AdapterCode: "1", MediaType: "banner"}}}
givenBidExt, _ := json.Marshal(bidExt)

givenBidResponse := rubiconBidResponse{
SeatBid: []rubiconSeatBid{{
Bid: []rubiconBid{{
Bid: openrtb2.Bid{Price: 123.2, ImpID: "test-imp-id", Ext: givenBidExt}}}}},
}
body, _ := json.Marshal(&givenBidResponse)
httpResp := &adapters.ResponseData{
StatusCode: http.StatusOK,
Body: body,
}

bidder := new(RubiconAdapter)
bidResponse, errs := bidder.MakeBids(request, reqData, httpResp)
assert.Empty(t, errs)

var actualBidExt openrtb_ext.ExtBid
err := json.Unmarshal(bidResponse.Bids[0].Bid.Ext, &actualBidExt)
assert.NoError(t, err)
assert.Equal(t, bidExt.Prebid.Meta, actualBidExt.Prebid.Meta)
}

func TestOpenRTBResponseOverridePriceFromCorrespondingImp(t *testing.T) {
request := &openrtb2.BidRequest{
ID: "test-request-id",
Expand Down
Loading