From d563ed2b4a8ceed0343583ef8a19bd887256079d Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Mon, 15 May 2023 14:21:07 -0400 Subject: [PATCH 1/7] feat: multiimp work in ixbidadapter behind ft, pass sid signal through from bidder params --- adapters/ix/ix.go | 296 ++++++++++++++++-- adapters/ix/ix_test.go | 239 +++++++++++++- adapters/ix/ixtest/supplemental/sid.json | 257 +++++++++++++++ .../exemplary/multi-imp-requests.json | 289 +++++++++++++++++ adapters/ix/params_test.go | 1 + openrtb_ext/imp_ix.go | 1 + static/bidder-params/ix.json | 5 + 7 files changed, 1063 insertions(+), 25 deletions(-) create mode 100644 adapters/ix/ixtest/supplemental/sid.json create mode 100644 adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index b17d913f42d..dfaf3faf48c 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -6,6 +6,7 @@ import ( "net/http" "sort" "strings" + "time" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" @@ -18,15 +19,28 @@ import ( "github.com/prebid/openrtb/v19/openrtb2" ) +const ( + FtHandleMultiImpOnSingleRequest = "pbs_handle_multi_imp_on_single_req" +) + +const ExpireFtTime = 3600 //1 hour + type IxAdapter struct { - URI string - maxRequests int + URI string + maxRequests int + clientFeatureStatusMap map[string]FeatureTimestamp + featuresToRequest []string } type ExtRequest struct { - Prebid *openrtb_ext.ExtRequestPrebid `json:"prebid"` - SChain *openrtb2.SupplyChain `json:"schain,omitempty"` - IxDiag *IxDiag `json:"ixdiag,omitempty"` + Prebid *openrtb_ext.ExtRequestPrebid `json:"prebid"` + SChain *openrtb2.SupplyChain `json:"schain,omitempty"` + IxDiag *IxDiag `json:"ixdiag,omitempty"` + Features map[string]Activated `json:"features,omitempty"` +} + +type Activated struct { + Activated bool `json:"activated"` } type IxDiag struct { @@ -34,30 +48,40 @@ type IxDiag struct { PbjsV string `json:"pbjsv,omitempty"` } +type FeatureTimestamp struct { + Timestamp int64 + Activated bool +} + func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { + if isFeatureToggleActive(a, FtHandleMultiImpOnSingleRequest) == true { + return handleMultiImpInSingleRequest(request, a) + } else { + return handleMultiImpByFlattening(request, a) + } +} + +func handleMultiImpByFlattening(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { nImp := len(request.Imp) if nImp > a.maxRequests { request.Imp = request.Imp[:a.maxRequests] nImp = a.maxRequests } - - errs := make([]error, 0) - - if err := BuildIxDiag(request); err != nil { - errs = append(errs, err) - } - // Multi-size banner imps are split into single-size requests. // The first size imp requests are added to the first slice. // Additional size requests are added to the second slice and are merged with the first at the end. // Preallocate the max possible size to avoid reallocating arrays. requests := make([]*adapters.RequestData, 0, a.maxRequests) multiSizeRequests := make([]*adapters.RequestData, 0, a.maxRequests-nImp) + errs := make([]error, 0, 1) + + if err := BuildIxDiag(request); err != nil { + errs = append(errs, err) + } headers := http.Header{ "Content-Type": {"application/json;charset=utf-8"}, "Accept": {"application/json"}} - imps := request.Imp for iImp := range imps { request.Imp = imps[iImp : iImp+1] @@ -67,7 +91,10 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters continue } } - + if err := moveSid(&request.Imp[0]); err != nil { + errs = append(errs, err) + } + requestFeatureToggles(a, request) if request.Imp[0].Banner != nil { banner := *request.Imp[0].Banner request.Imp[0].Banner = &banner @@ -100,6 +127,129 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters return append(requests, multiSizeRequests...), errs } +func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { + nImp := len(request.Imp) + if nImp > a.maxRequests { + request.Imp = request.Imp[:a.maxRequests] + nImp = a.maxRequests + } + // Multi-size banner imps are split into single-size requests. + // The first size imp requests are added to the first slice. + // Additional size requests are added to the second slice and are merged with the first at the end. + requests := make([]*adapters.RequestData, 0, a.maxRequests) + multiSizeRequests := make([]*adapters.RequestData, 0, a.maxRequests-1) + errs := make([]error, 0) + + if err := BuildIxDiag(request); err != nil { + errs = append(errs, err) + } + + headers := http.Header{ + "Content-Type": {"application/json;charset=utf-8"}, + "Accept": {"application/json"}} + + siteIds := make(map[string]bool) + originalImps := make([]openrtb2.Imp, 0, len(request.Imp)) + additionalMultiSizeImps := make([]openrtb2.Imp, 0) + requestCopy := *request + for _, imp := range requestCopy.Imp { + if err := parseSiteId(&imp, siteIds); err != nil { + errs = append(errs, err) + continue + } + + if err := moveSid(&imp); err != nil { + errs = append(errs, err) + } + + if imp.Banner != nil { + bannerCopy := *imp.Banner + + if len(bannerCopy.Format) == 0 && bannerCopy.W != nil && bannerCopy.H != nil { + bannerCopy.Format = []openrtb2.Format{{W: *bannerCopy.W, H: *bannerCopy.H}} + } + + if len(bannerCopy.Format) == 1 { + bannerCopy.W = openrtb2.Int64Ptr(bannerCopy.Format[0].W) + bannerCopy.H = openrtb2.Int64Ptr(bannerCopy.Format[0].H) + } + + if len(bannerCopy.Format) > 1 { + formats := bannerCopy.Format + // Creating additional imp from multiple formats. First format is part of original imp. Rest format will be converted to individual single imp & later request. + for iFmt := range formats { + additionalBannerCopy := *imp.Banner + additionalBannerCopy.Format = formats[iFmt : iFmt+1] + additionalBannerCopy.W = openrtb2.Int64Ptr(additionalBannerCopy.Format[0].W) + additionalBannerCopy.H = openrtb2.Int64Ptr(additionalBannerCopy.Format[0].H) + if iFmt == 0 { + bannerCopy = additionalBannerCopy + } else { + imp.Banner = &additionalBannerCopy + additionalMultiSizeImps = append(additionalMultiSizeImps, imp) + } + } + } + + imp.Banner = &bannerCopy + } + originalImps = append(originalImps, imp) + } + + if requestCopy.Site != nil { + site := *requestCopy.Site + if site.Publisher == nil { + site.Publisher = &openrtb2.Publisher{} + } + if len(siteIds) == 1 { + for siteId := range siteIds { + site.Publisher.ID = siteId + } + } + requestCopy.Site = &site + } + + requestCopy.Imp = originalImps + + requestFeatureToggles(a, &requestCopy) + + if len(requestCopy.Imp) != 0 { + if requestData, err := createRequestData(a, &requestCopy, &headers); err == nil { + requests = append(requests, requestData) + } else { + errs = append(errs, err) + } + } + + for i := range additionalMultiSizeImps { + requestCopy.Imp = additionalMultiSizeImps[i : i+1] + if requestData, err := createRequestData(a, &requestCopy, &headers); err == nil { + multiSizeRequests = append(multiSizeRequests, requestData) + } else { + errs = append(errs, err) + } + } + + return append(requests, multiSizeRequests...), errs +} + +func parseSiteId(imp *openrtb2.Imp, siteIds map[string]bool) error { + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return err + } + + var ixExt openrtb_ext.ExtImpIx + if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { + return err + } + + if ixExt.SiteId != "" { + siteIds[ixExt.SiteId] = true + } + return nil +} + func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { if iImp == 0 { // first impression - create a site and pub copy @@ -112,17 +262,14 @@ func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { } request.Site = &site } - var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(request.Imp[0].Ext, &bidderExt); err != nil { return err } - var ixExt openrtb_ext.ExtImpIx if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { return err } - request.Site.Publisher.ID = ixExt.SiteId return nil } @@ -165,6 +312,8 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalReque }} } + setFeatureToggles(a, &bidResponse.Ext) + // Store media type per impression in a map for later use to set in bid.ext.prebid.type // Won't work for multiple bid case with a multi-format ad unit. We expect to get type from exchange on such case. impMediaTypeReq := map[string]openrtb_ext.BidType{} @@ -180,7 +329,8 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalReque } } - bidderResponse := adapters.NewBidderResponseWithBidsCapacity(5) + // capacity 0 will make channel unbuffered + bidderResponse := adapters.NewBidderResponseWithBidsCapacity(0) bidderResponse.Currency = bidResponse.Cur var errs []error @@ -275,8 +425,10 @@ func getMediaTypeForBid(bid openrtb2.Bid, impMediaTypeReq map[string]openrtb_ext // Builder builds a new instance of the Ix adapter for the given bidder with the given config. func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &IxAdapter{ - URI: config.Endpoint, - maxRequests: 20, + URI: config.Endpoint, + maxRequests: 100, + clientFeatureStatusMap: make(map[string]FeatureTimestamp), + featuresToRequest: []string{FtHandleMultiImpOnSingleRequest}, } return bidder, nil } @@ -336,18 +488,15 @@ func BuildIxDiag(request *openrtb2.BidRequest) error { } } ixdiag := &IxDiag{} - if extRequest.Prebid != nil && extRequest.Prebid.Channel != nil { ixdiag.PbjsV = extRequest.Prebid.Channel.Version } - // Slice commit hash out of version if strings.Contains(version.Ver, "-") { ixdiag.PbsV = version.Ver[:strings.Index(version.Ver, "-")] } else if version.Ver != "" { ixdiag.PbsV = version.Ver } - // Only set request.ext if ixDiag is not empty if *ixdiag != (IxDiag{}) { extRequest.IxDiag = ixdiag @@ -359,3 +508,104 @@ func BuildIxDiag(request *openrtb2.BidRequest) error { } return nil } + +// moves sid from imp[].ext.bidder.sid to imp[].ext.sid +func moveSid(imp *openrtb2.Imp) error { + if imp.Ext == nil || len(imp.Ext) == 0 { + return nil + } + + var bidderExt adapters.ExtImpBidder + if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { + return err + } + + var ixExt openrtb_ext.ExtImpIx + if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { + return err + } + + if ixExt.Sid != "" { + var m map[string]interface{} + if err := json.Unmarshal(imp.Ext, &m); err != nil { + return err + } + m["sid"] = ixExt.Sid + ext, err := json.Marshal(m) + if err != nil { + return err + } + imp.Ext = ext + } + return nil +} + +func setFeatureToggles(a *IxAdapter, ext *json.RawMessage) { + if *ext == nil { + return + } + + var f interface{} + err := json.Unmarshal(*ext, &f) + + if err != nil { + return + } + + if features, ok := f.(map[string]interface{})["features"]; ok { + if ft, ok := features.(map[string]interface{}); ok { + for k, v := range ft { + if activated, ok := v.(map[string]interface{})["activated"]; ok { + a.clientFeatureStatusMap[k] = FeatureTimestamp{ + Activated: activated.(bool), + Timestamp: time.Now().Unix(), + } + } + } + } + } +} + +func isFeatureToggleActive(a *IxAdapter, ft string) bool { + if value, ok := a.clientFeatureStatusMap[ft]; ok { + timeNow := time.Now().Unix() + if timeNow-value.Timestamp > ExpireFtTime { + return false + } + return value.Activated + } + return false +} + +func requestFeatureToggles(a *IxAdapter, request *openrtb2.BidRequest) error { + if len(a.featuresToRequest) == 0 { + return nil + } + + extRequest := &ExtRequest{} + if request.Ext != nil { + if err := json.Unmarshal(request.Ext, &extRequest); err != nil { + return err + } + } + + for _, ft := range a.featuresToRequest { + if extRequest.Features == nil { + extRequest.Features = make(map[string]Activated) + } + + status := isFeatureToggleActive(a, ft) + + extRequest.Features[ft] = Activated{ + Activated: status, + } + + } + + extRequestJson, err := json.Marshal(extRequest) + if err != nil { + return err + } + request.Ext = extRequestJson + return nil +} diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 0f6b856dce4..f4d653121dd 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -3,6 +3,7 @@ package ix import ( "encoding/json" "testing" + "time" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" @@ -21,12 +22,29 @@ func TestJsonSamples(t *testing.T) { if bidder, err := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}); err == nil { ixBidder := bidder.(*IxAdapter) ixBidder.maxRequests = 2 + ixBidder.featuresToRequest = nil adapterstest.RunJSONBidderTest(t, "ixtest", bidder) } else { t.Fatalf("Builder returned unexpected error %v", err) } } +func TestJsonForMultiImpAndSize(t *testing.T) { + if bidder, err := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}); err == nil { + ixBidder := bidder.(*IxAdapter) + ixBidder.maxRequests = 2 + ixBidder.clientFeatureStatusMap = map[string]FeatureTimestamp{ + "pbs_handle_multi_imp_on_single_req": { + Activated: true, + Timestamp: time.Now().Unix(), + }, + } + adapterstest.RunJSONBidderTest(t, "ixtestmulti", bidder) + } else { + t.Fatalf("Builder returned unexpected error %v", err) + } +} + func TestIxMakeBidsWithCategoryDuration(t *testing.T) { bidder := &IxAdapter{} @@ -44,7 +62,7 @@ func TestIxMakeBidsWithCategoryDuration(t *testing.T) { `{ "prebid": {}, "bidder": { - "siteID": 123456 + "siteID": "123456" } }`, )}, @@ -124,7 +142,7 @@ func TestIxMakeRequestWithGppString(t *testing.T) { `{ "prebid": {}, "bidder": { - "siteID": 123456 + "siteId": "123456" } }`, )}, @@ -276,3 +294,220 @@ func TestMakeRequestsErrIxDiag(t *testing.T) { _, errs := bidder.MakeRequests(req, nil) assert.Len(t, errs, 1) } + +func TestSetFeatureToggles(t *testing.T) { + testCases := []struct { + description string + ext json.RawMessage + expected map[string]FeatureTimestamp + }{ + { + description: "nil ext", + ext: nil, + expected: map[string]FeatureTimestamp{}, + }, + { + description: "Empty input", + ext: json.RawMessage(``), + expected: map[string]FeatureTimestamp{}, + }, + { + description: "valid input with one feature toggle", + ext: json.RawMessage(`{"features":{"ft_test_1":{"activated":true}}}`), + expected: map[string]FeatureTimestamp{ + "ft_test_1": { + Activated: true, + Timestamp: time.Now().Unix(), + }, + }, + }, + { + description: "valid input with two feature toggles", + ext: json.RawMessage(`{"features":{"ft_test_1":{"activated":true},"ft_test_2":{"activated":false}}}`), + expected: map[string]FeatureTimestamp{ + "ft_test_1": { + Activated: true, + Timestamp: time.Now().Unix(), + }, + "ft_test_2": { + Activated: false, + Timestamp: time.Now().Unix(), + }, + }, + }, + { + description: "input with one feature toggle, no activated key", + ext: json.RawMessage(`{"features":{"ft_test_1":{"exists":true}}}`), + expected: map[string]FeatureTimestamp{}, + }, + { + description: "features not formatted correctly", + ext: json.RawMessage(`{"features":"helloworld"}`), + expected: map[string]FeatureTimestamp{}, + }, + { + description: "no features", + ext: json.RawMessage(`{"prebid":{"test":"helloworld"}}`), + expected: map[string]FeatureTimestamp{}, + }, + } + + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + ixBidder := bidder.(*IxAdapter) + setFeatureToggles(ixBidder, &tc.ext) + assert.Equal(t, tc.expected, ixBidder.clientFeatureStatusMap) + }) + } +} + +func TestGetFeatureToggle(t *testing.T) { + clientFeatureMap := map[string]FeatureTimestamp{ + "feature1": { + Activated: true, + Timestamp: time.Now().Unix(), + }, + "feature2": { + Activated: true, + Timestamp: time.Now().Unix() - 3700, + }, + "feature3": { + Activated: false, + Timestamp: time.Now().Unix(), + }, + } + + tests := []struct { + description string + ftName string + expected bool + }{ + {"ActivatedFeature", "feature1", true}, + {"ExpiredFeature", "feature2", false}, + {"NotExpiredFeature", "feature3", false}, + {"NonExistentFeature", "nonexistent", false}, + } + + for _, test := range tests { + t.Run(test.description, func(t *testing.T) { + bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + ixBidder := bidder.(*IxAdapter) + ixBidder.clientFeatureStatusMap = clientFeatureMap + result := isFeatureToggleActive(ixBidder, test.ftName) + assert.Equal(t, test.expected, result) + }) + } +} + +func TestRequestFeatureToggles(t *testing.T) { + type testCase struct { + name string + inputRequest *openrtb2.BidRequest + featuresToRequest []string + expectedExt json.RawMessage + initialFeatureMap *FeatureTimestamp + } + + testCases := []testCase{ + { + name: "empty features", + inputRequest: &openrtb2.BidRequest{ID: "1"}, + featuresToRequest: []string{}, + expectedExt: json.RawMessage(nil), + }, + { + name: "no features existing internally, request feature expect false", + inputRequest: &openrtb2.BidRequest{ID: "1"}, + featuresToRequest: []string{"ft1"}, + expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":false}}}`), + }, + { + name: "feature exists internally and activated", + inputRequest: &openrtb2.BidRequest{ID: "1"}, + featuresToRequest: []string{"ft1"}, + expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":true}}}`), + initialFeatureMap: &FeatureTimestamp{Timestamp: time.Now().Unix(), Activated: true}, + }, + { + name: "feature exists internally and not activated", + inputRequest: &openrtb2.BidRequest{ID: "1"}, + featuresToRequest: []string{"ft1"}, + expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":false}}}`), + initialFeatureMap: &FeatureTimestamp{Timestamp: time.Now().Unix(), Activated: false}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + ixBidder := bidder.(*IxAdapter) + if tc.initialFeatureMap != nil { + ixBidder.clientFeatureStatusMap["ft1"] = *tc.initialFeatureMap + } + ixBidder.featuresToRequest = tc.featuresToRequest + requestFeatureToggles(ixBidder, tc.inputRequest) + assert.Equal(t, tc.expectedExt, tc.inputRequest.Ext) + }) + } +} + +func TestMoveSid(t *testing.T) { + testCases := []struct { + description string + imp openrtb2.Imp + expectedExt json.RawMessage + expectErr bool + }{ + { + description: "valid input with sid", + imp: openrtb2.Imp{ + Ext: json.RawMessage(`{"bidder":{"sid":"1234"}}`), + }, + expectedExt: json.RawMessage(`{"bidder":{"sid":"1234"},"sid":"1234"}`), + expectErr: false, + }, + { + description: "valid input without sid", + imp: openrtb2.Imp{ + Ext: json.RawMessage(`{"bidder":{"siteId":"1234"}}`), + }, + expectedExt: json.RawMessage(`{"bidder":{"siteId":"1234"}}`), + expectErr: false, + }, + { + description: "no ext", + imp: openrtb2.Imp{ID: "1"}, + expectedExt: nil, + expectErr: false, + }, + { + description: "malformed json", + imp: openrtb2.Imp{ + Ext: json.RawMessage(`"bidder":{"sid":"1234"}`), + }, + expectedExt: json.RawMessage(`"bidder":{"sid":"1234"}`), + expectErr: true, + }, + { + description: "malformed bidder json", + imp: openrtb2.Imp{ + Ext: json.RawMessage(`{"bidder":{"sid":1234}}`), + }, + expectedExt: json.RawMessage(`{"bidder":{"sid":1234}}`), + expectErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + err := moveSid(&tc.imp) + assert.Equal(t, tc.expectedExt, tc.imp.Ext) + if tc.expectErr { + assert.NotNil(t, err) + } else { + assert.Nil(t, err) + } + }) + } +} diff --git a/adapters/ix/ixtest/supplemental/sid.json b/adapters/ix/ixtest/supplemental/sid.json new file mode 100644 index 00000000000..41afaedf524 --- /dev/null +++ b/adapters/ix/ixtest/supplemental/sid.json @@ -0,0 +1,257 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749", + "sid": "1234" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750", + "sid": "5678" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749", + "sid": "1234" + }, + "sid": "1234" + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750", + "sid": "5678" + }, + "sid": "5678" + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json b/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json new file mode 100644 index 00000000000..477e49745a7 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json @@ -0,0 +1,289 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 600, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + }, + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 600, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + }, + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/params_test.go b/adapters/ix/params_test.go index 9246a43a725..8ba937c12f4 100644 --- a/adapters/ix/params_test.go +++ b/adapters/ix/params_test.go @@ -38,6 +38,7 @@ var validParams = []string{ `{"siteID":"12345"}`, `{"siteId":"123456"}`, `{"siteid":"1234567", "size": [640,480]}`, + `{"siteId":"123456", "sid":"12345"}`, } var invalidParams = []string{ diff --git a/openrtb_ext/imp_ix.go b/openrtb_ext/imp_ix.go index 9f977fb0dcd..40c3f51867f 100644 --- a/openrtb_ext/imp_ix.go +++ b/openrtb_ext/imp_ix.go @@ -4,4 +4,5 @@ package openrtb_ext type ExtImpIx struct { SiteId string `json:"siteId"` Size []int `json:"size"` + Sid string `json:"sid"` } diff --git a/static/bidder-params/ix.json b/static/bidder-params/ix.json index a7a5cb7308a..172690cca32 100644 --- a/static/bidder-params/ix.json +++ b/static/bidder-params/ix.json @@ -27,6 +27,11 @@ "minItems": 2, "maxItems": 2, "description": "An array of two integer containing the dimension" + }, + "sid": { + "type": "string", + "minLength": 1, + "description": "Slot ID" } }, "oneOf": [ From d70d9d53fd8a11d228cd5ed8f9280bf44ae2edbc Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Tue, 6 Jun 2023 16:36:24 -0400 Subject: [PATCH 2/7] chore: pr feedback --- adapters/ix/ix.go | 70 +++-- adapters/ix/ix_test.go | 5 - .../exemplary/additional-consent.json | 132 ++++++++++ .../exemplary/banner-no-format.json | 116 +++++++++ .../ixtestmulti/exemplary/max-requests.json | 226 ++++++++++++++++ .../multi-format-with-ext-prebid-type.json | 162 ++++++++++++ .../exemplary/multi-format-with-mtype.json | 158 ++++++++++++ .../exemplary/multi-imp-requests.json | 139 +++------- .../ix/ixtestmulti/exemplary/multibid.json | 153 +++++++++++ .../native-eventtrackers-compat-12.json | 112 ++++++++ adapters/ix/ixtestmulti/exemplary/no-pub.json | 125 +++++++++ .../ixtestmulti/exemplary/simple-audio.json | 110 ++++++++ .../exemplary/simple-banner-multi-size.json | 142 ++++++++++ .../ixtestmulti/exemplary/simple-native.json | 112 ++++++++ .../ixtestmulti/exemplary/simple-video.json | 142 ++++++++++ .../ixtestmulti/exemplary/structured-pod.json | 244 ++++++++++++++++++ .../supplemental/bad-ext-bidder.json | 22 ++ .../ixtestmulti/supplemental/bad-ext-ix.json | 21 ++ .../ixtestmulti/supplemental/bad-imp-id.json | 99 +++++++ .../ixtestmulti/supplemental/bad-request.json | 71 +++++ .../supplemental/bad-response-body.json | 73 ++++++ .../multi-imp-requests-error.json | 197 ++++++++++++++ .../native-eventtrackers-empty.json | 112 ++++++++ .../native-eventtrackers-missing.json | 112 ++++++++ .../supplemental/native-missing.json | 112 ++++++++ .../ixtestmulti/supplemental/no-content.json | 65 +++++ .../ix/ixtestmulti/supplemental/no-imp.json | 6 + .../ixtestmulti/supplemental/not-found.json | 71 +++++ adapters/ix/ixtestmulti/supplemental/sid.json | 192 ++++++++++++++ 29 files changed, 3154 insertions(+), 147 deletions(-) create mode 100644 adapters/ix/ixtestmulti/exemplary/additional-consent.json create mode 100644 adapters/ix/ixtestmulti/exemplary/banner-no-format.json create mode 100644 adapters/ix/ixtestmulti/exemplary/max-requests.json create mode 100644 adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json create mode 100644 adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json create mode 100644 adapters/ix/ixtestmulti/exemplary/multibid.json create mode 100644 adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json create mode 100644 adapters/ix/ixtestmulti/exemplary/no-pub.json create mode 100644 adapters/ix/ixtestmulti/exemplary/simple-audio.json create mode 100644 adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json create mode 100644 adapters/ix/ixtestmulti/exemplary/simple-native.json create mode 100644 adapters/ix/ixtestmulti/exemplary/simple-video.json create mode 100644 adapters/ix/ixtestmulti/exemplary/structured-pod.json create mode 100644 adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json create mode 100644 adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json create mode 100644 adapters/ix/ixtestmulti/supplemental/bad-imp-id.json create mode 100644 adapters/ix/ixtestmulti/supplemental/bad-request.json create mode 100644 adapters/ix/ixtestmulti/supplemental/bad-response-body.json create mode 100644 adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json create mode 100644 adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json create mode 100644 adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json create mode 100644 adapters/ix/ixtestmulti/supplemental/native-missing.json create mode 100644 adapters/ix/ixtestmulti/supplemental/no-content.json create mode 100644 adapters/ix/ixtestmulti/supplemental/no-imp.json create mode 100644 adapters/ix/ixtestmulti/supplemental/not-found.json create mode 100644 adapters/ix/ixtestmulti/supplemental/sid.json diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index dfaf3faf48c..acc9be943a1 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -6,6 +6,7 @@ import ( "net/http" "sort" "strings" + "sync" "time" "github.com/prebid/prebid-server/adapters" @@ -20,16 +21,17 @@ import ( ) const ( - FtHandleMultiImpOnSingleRequest = "pbs_handle_multi_imp_on_single_req" + ftHandleMultiImpOnSingleRequest = "pbs_handle_multi_imp_on_single_req" ) -const ExpireFtTime = 3600 //1 hour +const expireFtTimeSeconds = 3600 //1 hour type IxAdapter struct { URI string maxRequests int clientFeatureStatusMap map[string]FeatureTimestamp featuresToRequest []string + mutex sync.Mutex } type ExtRequest struct { @@ -54,7 +56,7 @@ type FeatureTimestamp struct { } func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - if isFeatureToggleActive(a, FtHandleMultiImpOnSingleRequest) == true { + if isFeatureToggleActive(a, ftHandleMultiImpOnSingleRequest) == true { return handleMultiImpInSingleRequest(request, a) } else { return handleMultiImpByFlattening(request, a) @@ -73,7 +75,7 @@ func handleMultiImpByFlattening(request *openrtb2.BidRequest, a *IxAdapter) ([]* // Preallocate the max possible size to avoid reallocating arrays. requests := make([]*adapters.RequestData, 0, a.maxRequests) multiSizeRequests := make([]*adapters.RequestData, 0, a.maxRequests-nImp) - errs := make([]error, 0, 1) + var errs []error if err := BuildIxDiag(request); err != nil { errs = append(errs, err) @@ -128,11 +130,6 @@ func handleMultiImpByFlattening(request *openrtb2.BidRequest, a *IxAdapter) ([]* } func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { - nImp := len(request.Imp) - if nImp > a.maxRequests { - request.Imp = request.Imp[:a.maxRequests] - nImp = a.maxRequests - } // Multi-size banner imps are split into single-size requests. // The first size imp requests are added to the first slice. // Additional size requests are added to the second slice and are merged with the first at the end. @@ -148,7 +145,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( "Content-Type": {"application/json;charset=utf-8"}, "Accept": {"application/json"}} - siteIds := make(map[string]bool) + siteIds := []string{} originalImps := make([]openrtb2.Imp, 0, len(request.Imp)) additionalMultiSizeImps := make([]openrtb2.Imp, 0) requestCopy := *request @@ -202,9 +199,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( site.Publisher = &openrtb2.Publisher{} } if len(siteIds) == 1 { - for siteId := range siteIds { - site.Publisher.ID = siteId - } + site.Publisher.ID = siteIds[0] } requestCopy.Site = &site } @@ -213,18 +208,13 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( requestFeatureToggles(a, &requestCopy) - if len(requestCopy.Imp) != 0 { - if requestData, err := createRequestData(a, &requestCopy, &headers); err == nil { - requests = append(requests, requestData) - } else { - errs = append(errs, err) - } + if len(additionalMultiSizeImps) > 0 { + requestCopy.Imp = append(requestCopy.Imp, additionalMultiSizeImps...) } - for i := range additionalMultiSizeImps { - requestCopy.Imp = additionalMultiSizeImps[i : i+1] + if len(requestCopy.Imp) != 0 { if requestData, err := createRequestData(a, &requestCopy, &headers); err == nil { - multiSizeRequests = append(multiSizeRequests, requestData) + requests = append(requests, requestData) } else { errs = append(errs, err) } @@ -233,7 +223,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( return append(requests, multiSizeRequests...), errs } -func parseSiteId(imp *openrtb2.Imp, siteIds map[string]bool) error { +func parseSiteId(imp *openrtb2.Imp, siteIds []string) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return err @@ -245,7 +235,7 @@ func parseSiteId(imp *openrtb2.Imp, siteIds map[string]bool) error { } if ixExt.SiteId != "" { - siteIds[ixExt.SiteId] = true + siteIds = append(siteIds, ixExt.SiteId) } return nil } @@ -426,9 +416,9 @@ func getMediaTypeForBid(bid openrtb2.Bid, impMediaTypeReq map[string]openrtb_ext func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &IxAdapter{ URI: config.Endpoint, - maxRequests: 100, + maxRequests: 20, clientFeatureStatusMap: make(map[string]FeatureTimestamp), - featuresToRequest: []string{FtHandleMultiImpOnSingleRequest}, + featuresToRequest: []string{ftHandleMultiImpOnSingleRequest}, } return bidder, nil } @@ -511,7 +501,7 @@ func BuildIxDiag(request *openrtb2.BidRequest) error { // moves sid from imp[].ext.bidder.sid to imp[].ext.sid func moveSid(imp *openrtb2.Imp) error { - if imp.Ext == nil || len(imp.Ext) == 0 { + if len(imp.Ext) == 0 { return nil } @@ -541,27 +531,25 @@ func moveSid(imp *openrtb2.Imp) error { } func setFeatureToggles(a *IxAdapter, ext *json.RawMessage) { - if *ext == nil { + if ext == nil { return } - var f interface{} - err := json.Unmarshal(*ext, &f) + extRequest := &ExtRequest{} + err := json.Unmarshal(*ext, &extRequest) if err != nil { return } - if features, ok := f.(map[string]interface{})["features"]; ok { - if ft, ok := features.(map[string]interface{}); ok { - for k, v := range ft { - if activated, ok := v.(map[string]interface{})["activated"]; ok { - a.clientFeatureStatusMap[k] = FeatureTimestamp{ - Activated: activated.(bool), - Timestamp: time.Now().Unix(), - } - } - } + // Acquire a lock before accessing/modifying the map + a.mutex.Lock() + defer a.mutex.Unlock() + + for k, v := range extRequest.Features { + a.clientFeatureStatusMap[k] = FeatureTimestamp{ + Activated: v.Activated, + Timestamp: time.Now().Unix(), } } } @@ -569,7 +557,7 @@ func setFeatureToggles(a *IxAdapter, ext *json.RawMessage) { func isFeatureToggleActive(a *IxAdapter, ft string) bool { if value, ok := a.clientFeatureStatusMap[ft]; ok { timeNow := time.Now().Unix() - if timeNow-value.Timestamp > ExpireFtTime { + if timeNow-value.Timestamp > expireFtTimeSeconds { return false } return value.Activated diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index f4d653121dd..a728e62449c 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -335,11 +335,6 @@ func TestSetFeatureToggles(t *testing.T) { }, }, }, - { - description: "input with one feature toggle, no activated key", - ext: json.RawMessage(`{"features":{"ft_test_1":{"exists":true}}}`), - expected: map[string]FeatureTimestamp{}, - }, { description: "features not formatted correctly", ext: json.RawMessage(`{"features":"helloworld"}`), diff --git a/adapters/ix/ixtestmulti/exemplary/additional-consent.json b/adapters/ix/ixtestmulti/exemplary/additional-consent.json new file mode 100644 index 00000000000..7511522692c --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/additional-consent.json @@ -0,0 +1,132 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "user": { + "ext": { + "consent": "COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw", + "consented_providers_settings": { + "consented_providers": [1] + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "user": { + "ext": { + "consent": "COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw", + "consented_providers_settings": { + "consented_providers": [1] + } + } + }, + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/banner-no-format.json b/adapters/ix/ixtestmulti/exemplary/banner-no-format.json new file mode 100644 index 00000000000..48a20c0ac8d --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/banner-no-format.json @@ -0,0 +1,116 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/max-requests.json b/adapters/ix/ixtestmulti/exemplary/max-requests.json new file mode 100644 index 00000000000..ea5032f6eff --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/max-requests.json @@ -0,0 +1,226 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "banner": { + "format": [ + { + "h": 600, + "w": 300 + } + ], + "h": 600, + "w": 300 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + }, + "id": "test-imp-id-3" + }, + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json b/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json new file mode 100644 index 00000000000..e9af9d7fd09 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json @@ -0,0 +1,162 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "multi-format-test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "multi-format-test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "v-2", + "impid": "multi-format-test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {}, + "prebid": { + "type": "video" + } + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "v-2", + "impid": "multi-format-test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {}, + "prebid": { + "type": "video" + } + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json b/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json new file mode 100644 index 00000000000..fe70deaf52e --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json @@ -0,0 +1,158 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "multi-format-test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "multi-format-test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "v-2", + "impid": "multi-format-test-imp-id", + "mtype": 2, + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "v-2", + "impid": "multi-format-test-imp-id", + "mtype": 2, + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json b/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json index 477e49745a7..776f772ebb5 100644 --- a/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json +++ b/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json @@ -79,74 +79,6 @@ "prebid": null }, "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id-1", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 600, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", "imp": [ { "id": "test-imp-id-1", @@ -190,6 +122,42 @@ "siteId": "569749" } } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } } ] } @@ -204,7 +172,7 @@ "bid": [ { "id": "7706636740145184841", - "impid": "test-imp-id-2", + "impid": "test-imp-id-1", "price": 0.5, "adid": "29681110", "adm": "some-test-ad", @@ -213,11 +181,8 @@ ], "cid": "958", "crid": "29681110", - "h": 250, + "h": 600, "w": 300, - "cat": [ - "IAB9-1" - ], "ext": { "ix": {} } @@ -256,34 +221,6 @@ "type": "banner" } ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id-2", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] } ] } diff --git a/adapters/ix/ixtestmulti/exemplary/multibid.json b/adapters/ix/ixtestmulti/exemplary/multibid.json new file mode 100644 index 00000000000..8111552dd86 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/multibid.json @@ -0,0 +1,153 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "1", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + }, + { + "id": "2", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "1", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + }, + { + "bid": { + "id": "2", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json b/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json new file mode 100644 index 00000000000..e39667efeea --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http: //i.am.a/URL\"},\"eventtrackers\":[{\"url\":\"https://example.com/imp-2.gif\",\"event\":1,\"method\":1},{\"url\":\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\",\"event\":1,\"method\":1}],\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http: //i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\",\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://example.com/imp-2.gif\"},{\"event\":1,\"method\":1,\"url\":\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\"}]}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/no-pub.json b/adapters/ix/ixtestmulti/exemplary/no-pub.json new file mode 100644 index 00000000000..4bdb3bcbd28 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/no-pub.json @@ -0,0 +1,125 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "site": { + "page": "https://www.example.com/" + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "site": { + "page": "https://www.example.com/", + "publisher": { + "id": "569749" + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-audio.json b/adapters/ix/ixtestmulti/exemplary/simple-audio.json new file mode 100644 index 00000000000..c942c0615a8 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/simple-audio.json @@ -0,0 +1,110 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "audio": { + "mimes": [ + "audio/mp4" + ], + "protocols": [ + 9, + 10 + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110" + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110" + }, + "type": "audio" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json b/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json new file mode 100644 index 00000000000..94113960c16 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json @@ -0,0 +1,142 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-native.json b/adapters/ix/ixtestmulti/exemplary/simple-native.json new file mode 100644 index 00000000000..4f2c07f9e5d --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/simple-native.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-video.json b/adapters/ix/ixtestmulti/exemplary/simple-video.json new file mode 100644 index 00000000000..0cf488949e9 --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/simple-video.json @@ -0,0 +1,142 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "cat": [ + "IAB9-1" + ], + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/exemplary/structured-pod.json b/adapters/ix/ixtestmulti/exemplary/structured-pod.json new file mode 100644 index 00000000000..4e0add6708e --- /dev/null +++ b/adapters/ix/ixtestmulti/exemplary/structured-pod.json @@ -0,0 +1,244 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560, + "podid": "1", + "slotinpod": 1, + "podseq": 1 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560, + "podid": "1", + "slotinpod": -1, + "podseq": 1 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560, + "podid": "1", + "slotinpod": 1, + "podseq": 1 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560, + "podid": "1", + "slotinpod": -1, + "podseq": 1 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 560, + "w": 940, + "dur": 30, + "ext": { + "ix": {} + } + } + ] + }, + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.75, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 560, + "w": 940, + "dur": 30, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 560, + "w": 940, + "dur": 30, + "ext": { + "ix": {} + } + }, + "type": "video" + }, + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-2", + "price": 0.75, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 560, + "w": 940, + "dur": 30, + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json b/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json new file mode 100644 index 00000000000..e08da1e1a84 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json @@ -0,0 +1,22 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "ext": { + "prebid": 1 + } + } + ], + "site": { + "page": "https://www.example.com/" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "json: cannot unmarshal number into Go struct field ExtImpBidder.prebid of type openrtb_ext.ExtImpPrebid", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json b/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json new file mode 100644 index 00000000000..a9a0383b1a1 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json @@ -0,0 +1,21 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "ext": { + } + } + ], + "site": { + "page": "https://www.example.com/" + } + }, + "expectedMakeRequestsErrors": [ + { + "value": "unexpected end of JSON input", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json b/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json new file mode 100644 index 00000000000..0884dcb83eb --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json @@ -0,0 +1,99 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "bad-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "unmatched impression id: bad-imp-id", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-request.json b/adapters/ix/ixtestmulti/supplemental/bad-request.json new file mode 100644 index 00000000000..7cacff1b601 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/bad-request.json @@ -0,0 +1,71 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 400, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-response-body.json b/adapters/ix/ixtestmulti/supplemental/bad-response-body.json new file mode 100644 index 00000000000..9d9a47380df --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/bad-response-body.json @@ -0,0 +1,73 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": 1 + } + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "JSON parsing error: json: cannot unmarshal number into Go struct field BidResponse.id of type string", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json b/adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json new file mode 100644 index 00000000000..3e051d4deb2 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json @@ -0,0 +1,197 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + }, + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749", + "sid": 12345 + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 600, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 600, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ], + "expectedMakeRequestsErrors": [ + { + "value": "json: cannot unmarshal number into Go struct field ExtImpIx.sid of type string", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json new file mode 100644 index 00000000000..49065c22258 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ], + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"],\"eventtrackers\":[]}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"],\"eventtrackers\":[]}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json new file mode 100644 index 00000000000..232fc65ef6d --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/native-missing.json b/adapters/ix/ixtestmulti/supplemental/native-missing.json new file mode 100644 index 00000000000..8cc88a61b3f --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/native-missing.json @@ -0,0 +1,112 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpcalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "native": { + "request": "{}", + "ver": "1.1" + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "{\"native\":{}}", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "cat": [ + "IAB3-1" + ], + "ext": { + "ix": {} + } + }, + "type": "native" + } + ] + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/no-content.json b/adapters/ix/ixtestmulti/supplemental/no-content.json new file mode 100644 index 00000000000..874e1a09102 --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/no-content.json @@ -0,0 +1,65 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 204, + "body": {} + } + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/no-imp.json b/adapters/ix/ixtestmulti/supplemental/no-imp.json new file mode 100644 index 00000000000..308decd2ccc --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/no-imp.json @@ -0,0 +1,6 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [] + } +} diff --git a/adapters/ix/ixtestmulti/supplemental/not-found.json b/adapters/ix/ixtestmulti/supplemental/not-found.json new file mode 100644 index 00000000000..632deda428f --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/not-found.json @@ -0,0 +1,71 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + } + ] + } + }, + "mockResponse": { + "status": 404, + "body": {} + } + } + ], + "expectedMakeBidsErrors": [ + { + "value": "Unexpected status code: 404. Run with request.debug = 1 for more info", + "comparison": "literal" + } + ] +} diff --git a/adapters/ix/ixtestmulti/supplemental/sid.json b/adapters/ix/ixtestmulti/supplemental/sid.json new file mode 100644 index 00000000000..de0d1ca689c --- /dev/null +++ b/adapters/ix/ixtestmulti/supplemental/sid.json @@ -0,0 +1,192 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749", + "sid": "1234" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750", + "sid": "5678" + } + } + } + ] + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "ext": { + "features": { + "pbs_handle_multi_imp_on_single_req": { + "activated": true + } + }, + "prebid": null + }, + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569749", + "sid": "1234" + }, + "sid": "1234" + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750", + "sid": "5678" + }, + "sid": "5678" + } + } + ] + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "video" + } + ] + } + ] +} From 136fc5a1d84d23277e1a4a343a2f176e91711090 Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Wed, 7 Jun 2023 11:50:04 -0400 Subject: [PATCH 3/7] chore: update siteid logic --- adapters/ix/ix.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index acc9be943a1..4014b43c806 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -150,7 +150,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( additionalMultiSizeImps := make([]openrtb2.Imp, 0) requestCopy := *request for _, imp := range requestCopy.Imp { - if err := parseSiteId(&imp, siteIds); err != nil { + if err := parseSiteId(&imp, &siteIds); err != nil { errs = append(errs, err) continue } @@ -223,7 +223,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( return append(requests, multiSizeRequests...), errs } -func parseSiteId(imp *openrtb2.Imp, siteIds []string) error { +func parseSiteId(imp *openrtb2.Imp, siteIds *[]string) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { return err @@ -235,7 +235,7 @@ func parseSiteId(imp *openrtb2.Imp, siteIds []string) error { } if ixExt.SiteId != "" { - siteIds = append(siteIds, ixExt.SiteId) + *siteIds = append(*siteIds, ixExt.SiteId) } return nil } From 91e8e76b53378c42e75476a98d11d838f30a3a2f Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Fri, 9 Jun 2023 15:06:37 -0400 Subject: [PATCH 4/7] chore: remove feature toggle logic --- adapters/ix/ix.go | 200 ++-------------- adapters/ix/ix_test.go | 170 ------------- .../ix/ixtest/exemplary/max-requests.json | 113 +++------ .../exemplary/multi-imp-requests.json | 8 - .../exemplary/simple-banner-multi-size.json | 71 +----- .../exemplary/structured-pod.json | 8 - .../multi-imp-requests-error.json | 8 - adapters/ix/ixtest/supplemental/sid.json | 77 +----- .../exemplary/additional-consent.json | 132 ---------- .../exemplary/banner-no-format.json | 116 --------- .../ixtestmulti/exemplary/max-requests.json | 226 ------------------ .../multi-format-with-ext-prebid-type.json | 162 ------------- .../exemplary/multi-format-with-mtype.json | 158 ------------ .../ix/ixtestmulti/exemplary/multibid.json | 153 ------------ .../native-eventtrackers-compat-12.json | 112 --------- adapters/ix/ixtestmulti/exemplary/no-pub.json | 125 ---------- .../ixtestmulti/exemplary/simple-audio.json | 110 --------- .../exemplary/simple-banner-multi-size.json | 142 ----------- .../ixtestmulti/exemplary/simple-native.json | 112 --------- .../ixtestmulti/exemplary/simple-video.json | 142 ----------- .../supplemental/bad-ext-bidder.json | 22 -- .../ixtestmulti/supplemental/bad-ext-ix.json | 21 -- .../ixtestmulti/supplemental/bad-imp-id.json | 99 -------- .../ixtestmulti/supplemental/bad-request.json | 71 ------ .../supplemental/bad-response-body.json | 73 ------ .../native-eventtrackers-empty.json | 112 --------- .../native-eventtrackers-missing.json | 112 --------- .../supplemental/native-missing.json | 112 --------- .../ixtestmulti/supplemental/no-content.json | 65 ----- .../ix/ixtestmulti/supplemental/no-imp.json | 6 - .../ixtestmulti/supplemental/not-found.json | 71 ------ adapters/ix/ixtestmulti/supplemental/sid.json | 192 --------------- static/bidder-info/mediafuse.yaml | 4 +- 33 files changed, 63 insertions(+), 3242 deletions(-) rename adapters/ix/{ixtestmulti => ixtest}/exemplary/multi-imp-requests.json (96%) rename adapters/ix/{ixtestmulti => ixtest}/exemplary/structured-pod.json (96%) rename adapters/ix/{ixtestmulti => ixtest}/supplemental/multi-imp-requests-error.json (95%) delete mode 100644 adapters/ix/ixtestmulti/exemplary/additional-consent.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/banner-no-format.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/max-requests.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/multibid.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/no-pub.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/simple-audio.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/simple-native.json delete mode 100644 adapters/ix/ixtestmulti/exemplary/simple-video.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/bad-imp-id.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/bad-request.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/bad-response-body.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/native-missing.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/no-content.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/no-imp.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/not-found.json delete mode 100644 adapters/ix/ixtestmulti/supplemental/sid.json diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 4014b43c806..ab64aa6ab9a 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -6,8 +6,6 @@ import ( "net/http" "sort" "strings" - "sync" - "time" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" @@ -20,29 +18,15 @@ import ( "github.com/prebid/openrtb/v19/openrtb2" ) -const ( - ftHandleMultiImpOnSingleRequest = "pbs_handle_multi_imp_on_single_req" -) - -const expireFtTimeSeconds = 3600 //1 hour - type IxAdapter struct { - URI string - maxRequests int - clientFeatureStatusMap map[string]FeatureTimestamp - featuresToRequest []string - mutex sync.Mutex + URI string + maxRequests int } type ExtRequest struct { - Prebid *openrtb_ext.ExtRequestPrebid `json:"prebid"` - SChain *openrtb2.SupplyChain `json:"schain,omitempty"` - IxDiag *IxDiag `json:"ixdiag,omitempty"` - Features map[string]Activated `json:"features,omitempty"` -} - -type Activated struct { - Activated bool `json:"activated"` + Prebid *openrtb_ext.ExtRequestPrebid `json:"prebid"` + SChain *openrtb2.SupplyChain `json:"schain,omitempty"` + IxDiag *IxDiag `json:"ixdiag,omitempty"` } type IxDiag struct { @@ -50,83 +34,8 @@ type IxDiag struct { PbjsV string `json:"pbjsv,omitempty"` } -type FeatureTimestamp struct { - Timestamp int64 - Activated bool -} - func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - if isFeatureToggleActive(a, ftHandleMultiImpOnSingleRequest) == true { - return handleMultiImpInSingleRequest(request, a) - } else { - return handleMultiImpByFlattening(request, a) - } -} - -func handleMultiImpByFlattening(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { - nImp := len(request.Imp) - if nImp > a.maxRequests { - request.Imp = request.Imp[:a.maxRequests] - nImp = a.maxRequests - } - // Multi-size banner imps are split into single-size requests. - // The first size imp requests are added to the first slice. - // Additional size requests are added to the second slice and are merged with the first at the end. - // Preallocate the max possible size to avoid reallocating arrays. - requests := make([]*adapters.RequestData, 0, a.maxRequests) - multiSizeRequests := make([]*adapters.RequestData, 0, a.maxRequests-nImp) - var errs []error - - if err := BuildIxDiag(request); err != nil { - errs = append(errs, err) - } - - headers := http.Header{ - "Content-Type": {"application/json;charset=utf-8"}, - "Accept": {"application/json"}} - imps := request.Imp - for iImp := range imps { - request.Imp = imps[iImp : iImp+1] - if request.Site != nil { - if err := setSitePublisherId(request, iImp); err != nil { - errs = append(errs, err) - continue - } - } - if err := moveSid(&request.Imp[0]); err != nil { - errs = append(errs, err) - } - requestFeatureToggles(a, request) - if request.Imp[0].Banner != nil { - banner := *request.Imp[0].Banner - request.Imp[0].Banner = &banner - formats := getBannerFormats(&banner) - for iFmt := range formats { - banner.Format = formats[iFmt : iFmt+1] - banner.W = openrtb2.Int64Ptr(banner.Format[0].W) - banner.H = openrtb2.Int64Ptr(banner.Format[0].H) - if requestData, err := createRequestData(a, request, &headers); err == nil { - if iFmt == 0 { - requests = append(requests, requestData) - } else { - multiSizeRequests = append(multiSizeRequests, requestData) - } - } else { - errs = append(errs, err) - } - if len(multiSizeRequests) == cap(multiSizeRequests) { - break - } - } - } else if requestData, err := createRequestData(a, request, &headers); err == nil { - requests = append(requests, requestData) - } else { - errs = append(errs, err) - } - } - request.Imp = imps - - return append(requests, multiSizeRequests...), errs + return handleMultiImpInSingleRequest(request, a) } func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { @@ -134,7 +43,6 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( // The first size imp requests are added to the first slice. // Additional size requests are added to the second slice and are merged with the first at the end. requests := make([]*adapters.RequestData, 0, a.maxRequests) - multiSizeRequests := make([]*adapters.RequestData, 0, a.maxRequests-1) errs := make([]error, 0) if err := BuildIxDiag(request); err != nil { @@ -150,7 +58,8 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( additionalMultiSizeImps := make([]openrtb2.Imp, 0) requestCopy := *request for _, imp := range requestCopy.Imp { - if err := parseSiteId(&imp, &siteIds); err != nil { + var err error + if siteIds, err = parseSiteId(&imp, siteIds); err != nil { errs = append(errs, err) continue } @@ -197,6 +106,9 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( site := *requestCopy.Site if site.Publisher == nil { site.Publisher = &openrtb2.Publisher{} + } else { + publisher := *site.Publisher + site.Publisher = &publisher } if len(siteIds) == 1 { site.Publisher.ID = siteIds[0] @@ -206,8 +118,6 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( requestCopy.Imp = originalImps - requestFeatureToggles(a, &requestCopy) - if len(additionalMultiSizeImps) > 0 { requestCopy.Imp = append(requestCopy.Imp, additionalMultiSizeImps...) } @@ -220,24 +130,24 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( } } - return append(requests, multiSizeRequests...), errs + return requests, errs } -func parseSiteId(imp *openrtb2.Imp, siteIds *[]string) error { +func parseSiteId(imp *openrtb2.Imp, siteIds []string) ([]string, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return err + return nil, err } var ixExt openrtb_ext.ExtImpIx if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { - return err + return nil, err } if ixExt.SiteId != "" { - *siteIds = append(*siteIds, ixExt.SiteId) + siteIds = append(siteIds, ixExt.SiteId) } - return nil + return siteIds, nil } func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { @@ -302,8 +212,6 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalReque }} } - setFeatureToggles(a, &bidResponse.Ext) - // Store media type per impression in a map for later use to set in bid.ext.prebid.type // Won't work for multiple bid case with a multi-format ad unit. We expect to get type from exchange on such case. impMediaTypeReq := map[string]openrtb_ext.BidType{} @@ -415,10 +323,8 @@ func getMediaTypeForBid(bid openrtb2.Bid, impMediaTypeReq map[string]openrtb_ext // Builder builds a new instance of the Ix adapter for the given bidder with the given config. func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &IxAdapter{ - URI: config.Endpoint, - maxRequests: 20, - clientFeatureStatusMap: make(map[string]FeatureTimestamp), - featuresToRequest: []string{ftHandleMultiImpOnSingleRequest}, + URI: config.Endpoint, + maxRequests: 20, } return bidder, nil } @@ -529,71 +435,3 @@ func moveSid(imp *openrtb2.Imp) error { } return nil } - -func setFeatureToggles(a *IxAdapter, ext *json.RawMessage) { - if ext == nil { - return - } - - extRequest := &ExtRequest{} - err := json.Unmarshal(*ext, &extRequest) - - if err != nil { - return - } - - // Acquire a lock before accessing/modifying the map - a.mutex.Lock() - defer a.mutex.Unlock() - - for k, v := range extRequest.Features { - a.clientFeatureStatusMap[k] = FeatureTimestamp{ - Activated: v.Activated, - Timestamp: time.Now().Unix(), - } - } -} - -func isFeatureToggleActive(a *IxAdapter, ft string) bool { - if value, ok := a.clientFeatureStatusMap[ft]; ok { - timeNow := time.Now().Unix() - if timeNow-value.Timestamp > expireFtTimeSeconds { - return false - } - return value.Activated - } - return false -} - -func requestFeatureToggles(a *IxAdapter, request *openrtb2.BidRequest) error { - if len(a.featuresToRequest) == 0 { - return nil - } - - extRequest := &ExtRequest{} - if request.Ext != nil { - if err := json.Unmarshal(request.Ext, &extRequest); err != nil { - return err - } - } - - for _, ft := range a.featuresToRequest { - if extRequest.Features == nil { - extRequest.Features = make(map[string]Activated) - } - - status := isFeatureToggleActive(a, ft) - - extRequest.Features[ft] = Activated{ - Activated: status, - } - - } - - extRequestJson, err := json.Marshal(extRequest) - if err != nil { - return err - } - request.Ext = extRequestJson - return nil -} diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index a728e62449c..fd2427691da 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -3,7 +3,6 @@ package ix import ( "encoding/json" "testing" - "time" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/adapters/adapterstest" @@ -22,29 +21,12 @@ func TestJsonSamples(t *testing.T) { if bidder, err := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}); err == nil { ixBidder := bidder.(*IxAdapter) ixBidder.maxRequests = 2 - ixBidder.featuresToRequest = nil adapterstest.RunJSONBidderTest(t, "ixtest", bidder) } else { t.Fatalf("Builder returned unexpected error %v", err) } } -func TestJsonForMultiImpAndSize(t *testing.T) { - if bidder, err := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}); err == nil { - ixBidder := bidder.(*IxAdapter) - ixBidder.maxRequests = 2 - ixBidder.clientFeatureStatusMap = map[string]FeatureTimestamp{ - "pbs_handle_multi_imp_on_single_req": { - Activated: true, - Timestamp: time.Now().Unix(), - }, - } - adapterstest.RunJSONBidderTest(t, "ixtestmulti", bidder) - } else { - t.Fatalf("Builder returned unexpected error %v", err) - } -} - func TestIxMakeBidsWithCategoryDuration(t *testing.T) { bidder := &IxAdapter{} @@ -295,158 +277,6 @@ func TestMakeRequestsErrIxDiag(t *testing.T) { assert.Len(t, errs, 1) } -func TestSetFeatureToggles(t *testing.T) { - testCases := []struct { - description string - ext json.RawMessage - expected map[string]FeatureTimestamp - }{ - { - description: "nil ext", - ext: nil, - expected: map[string]FeatureTimestamp{}, - }, - { - description: "Empty input", - ext: json.RawMessage(``), - expected: map[string]FeatureTimestamp{}, - }, - { - description: "valid input with one feature toggle", - ext: json.RawMessage(`{"features":{"ft_test_1":{"activated":true}}}`), - expected: map[string]FeatureTimestamp{ - "ft_test_1": { - Activated: true, - Timestamp: time.Now().Unix(), - }, - }, - }, - { - description: "valid input with two feature toggles", - ext: json.RawMessage(`{"features":{"ft_test_1":{"activated":true},"ft_test_2":{"activated":false}}}`), - expected: map[string]FeatureTimestamp{ - "ft_test_1": { - Activated: true, - Timestamp: time.Now().Unix(), - }, - "ft_test_2": { - Activated: false, - Timestamp: time.Now().Unix(), - }, - }, - }, - { - description: "features not formatted correctly", - ext: json.RawMessage(`{"features":"helloworld"}`), - expected: map[string]FeatureTimestamp{}, - }, - { - description: "no features", - ext: json.RawMessage(`{"prebid":{"test":"helloworld"}}`), - expected: map[string]FeatureTimestamp{}, - }, - } - - for _, tc := range testCases { - t.Run(tc.description, func(t *testing.T) { - bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - ixBidder := bidder.(*IxAdapter) - setFeatureToggles(ixBidder, &tc.ext) - assert.Equal(t, tc.expected, ixBidder.clientFeatureStatusMap) - }) - } -} - -func TestGetFeatureToggle(t *testing.T) { - clientFeatureMap := map[string]FeatureTimestamp{ - "feature1": { - Activated: true, - Timestamp: time.Now().Unix(), - }, - "feature2": { - Activated: true, - Timestamp: time.Now().Unix() - 3700, - }, - "feature3": { - Activated: false, - Timestamp: time.Now().Unix(), - }, - } - - tests := []struct { - description string - ftName string - expected bool - }{ - {"ActivatedFeature", "feature1", true}, - {"ExpiredFeature", "feature2", false}, - {"NotExpiredFeature", "feature3", false}, - {"NonExistentFeature", "nonexistent", false}, - } - - for _, test := range tests { - t.Run(test.description, func(t *testing.T) { - bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - ixBidder := bidder.(*IxAdapter) - ixBidder.clientFeatureStatusMap = clientFeatureMap - result := isFeatureToggleActive(ixBidder, test.ftName) - assert.Equal(t, test.expected, result) - }) - } -} - -func TestRequestFeatureToggles(t *testing.T) { - type testCase struct { - name string - inputRequest *openrtb2.BidRequest - featuresToRequest []string - expectedExt json.RawMessage - initialFeatureMap *FeatureTimestamp - } - - testCases := []testCase{ - { - name: "empty features", - inputRequest: &openrtb2.BidRequest{ID: "1"}, - featuresToRequest: []string{}, - expectedExt: json.RawMessage(nil), - }, - { - name: "no features existing internally, request feature expect false", - inputRequest: &openrtb2.BidRequest{ID: "1"}, - featuresToRequest: []string{"ft1"}, - expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":false}}}`), - }, - { - name: "feature exists internally and activated", - inputRequest: &openrtb2.BidRequest{ID: "1"}, - featuresToRequest: []string{"ft1"}, - expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":true}}}`), - initialFeatureMap: &FeatureTimestamp{Timestamp: time.Now().Unix(), Activated: true}, - }, - { - name: "feature exists internally and not activated", - inputRequest: &openrtb2.BidRequest{ID: "1"}, - featuresToRequest: []string{"ft1"}, - expectedExt: json.RawMessage(`{"prebid":null,"features":{"ft1":{"activated":false}}}`), - initialFeatureMap: &FeatureTimestamp{Timestamp: time.Now().Unix(), Activated: false}, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - bidder, _ := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) - ixBidder := bidder.(*IxAdapter) - if tc.initialFeatureMap != nil { - ixBidder.clientFeatureStatusMap["ft1"] = *tc.initialFeatureMap - } - ixBidder.featuresToRequest = tc.featuresToRequest - requestFeatureToggles(ixBidder, tc.inputRequest) - assert.Equal(t, tc.expectedExt, tc.inputRequest.Ext) - }) - } -} - func TestMoveSid(t *testing.T) { testCases := []struct { description string diff --git a/adapters/ix/ixtest/exemplary/max-requests.json b/adapters/ix/ixtest/exemplary/max-requests.json index 46d9ec5d6b7..b152cdbac10 100644 --- a/adapters/ix/ixtest/exemplary/max-requests.json +++ b/adapters/ix/ixtest/exemplary/max-requests.json @@ -89,49 +89,7 @@ "siteId": "569749" } } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ + }, { "id": "test-imp-id-2", "video": { @@ -156,6 +114,42 @@ "siteId": "569749" } } + }, + { + "banner": { + "format": [ + { + "h": 600, + "w": 300 + } + ], + "h": 600, + "w": 300 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + }, + "id": "test-imp-id-3" + }, + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ], + "w": 300, + "h": 600 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } } ] } @@ -170,7 +164,7 @@ "bid": [ { "id": "7706636740145184841", - "impid": "test-imp-id-2", + "impid": "test-imp-id-1", "price": 0.5, "adid": "29681110", "adm": "some-test-ad", @@ -181,9 +175,6 @@ "crid": "29681110", "h": 250, "w": 300, - "cat": [ - "IAB9-1" - ], "ext": { "ix": {} } @@ -222,34 +213,6 @@ "type": "banner" } ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id-2", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] } ] } diff --git a/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json b/adapters/ix/ixtest/exemplary/multi-imp-requests.json similarity index 96% rename from adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json rename to adapters/ix/ixtest/exemplary/multi-imp-requests.json index 776f772ebb5..41cb9975800 100644 --- a/adapters/ix/ixtestmulti/exemplary/multi-imp-requests.json +++ b/adapters/ix/ixtest/exemplary/multi-imp-requests.json @@ -70,14 +70,6 @@ "expectedRequest": { "uri": "http://host/endpoint", "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, "id": "test-request-id", "imp": [ { diff --git a/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json b/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json index 5e0a311a91b..d996836d241 100644 --- a/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json +++ b/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json @@ -48,49 +48,7 @@ "siteId": "569749" } } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ + }, { "id": "test-imp-id", "banner": { @@ -131,7 +89,7 @@ ], "cid": "958", "crid": "29681110", - "h": 600, + "h": 250, "w": 300, "ext": { "ix": {} @@ -171,31 +129,6 @@ "type": "banner" } ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 600, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] } ] } diff --git a/adapters/ix/ixtestmulti/exemplary/structured-pod.json b/adapters/ix/ixtest/exemplary/structured-pod.json similarity index 96% rename from adapters/ix/ixtestmulti/exemplary/structured-pod.json rename to adapters/ix/ixtest/exemplary/structured-pod.json index 4e0add6708e..a5ca9895554 100644 --- a/adapters/ix/ixtestmulti/exemplary/structured-pod.json +++ b/adapters/ix/ixtest/exemplary/structured-pod.json @@ -65,14 +65,6 @@ "expectedRequest": { "uri": "http://host/endpoint", "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, "id": "test-request-id", "imp": [ { diff --git a/adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json b/adapters/ix/ixtest/supplemental/multi-imp-requests-error.json similarity index 95% rename from adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json rename to adapters/ix/ixtest/supplemental/multi-imp-requests-error.json index 3e051d4deb2..223e863284c 100644 --- a/adapters/ix/ixtestmulti/supplemental/multi-imp-requests-error.json +++ b/adapters/ix/ixtest/supplemental/multi-imp-requests-error.json @@ -71,14 +71,6 @@ "expectedRequest": { "uri": "http://host/endpoint", "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, "id": "test-request-id", "imp": [ { diff --git a/adapters/ix/ixtest/supplemental/sid.json b/adapters/ix/ixtest/supplemental/sid.json index 41afaedf524..c2156b6b20d 100644 --- a/adapters/ix/ixtest/supplemental/sid.json +++ b/adapters/ix/ixtest/supplemental/sid.json @@ -89,49 +89,7 @@ }, "sid": "1234" } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - }, - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ + }, { "id": "test-imp-id-2", "video": { @@ -172,7 +130,7 @@ "bid": [ { "id": "7706636740145184841", - "impid": "test-imp-id-2", + "impid": "test-imp-id-1", "price": 0.5, "adid": "29681110", "adm": "some-test-ad", @@ -183,9 +141,6 @@ "crid": "29681110", "h": 250, "w": 300, - "cat": [ - "IAB9-1" - ], "ext": { "ix": {} } @@ -224,34 +179,6 @@ "type": "video" } ] - }, - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id-2", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] } ] } diff --git a/adapters/ix/ixtestmulti/exemplary/additional-consent.json b/adapters/ix/ixtestmulti/exemplary/additional-consent.json deleted file mode 100644 index 7511522692c..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/additional-consent.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "user": { - "ext": { - "consent": "COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw", - "consented_providers_settings": { - "consented_providers": [1] - } - } - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "user": { - "ext": { - "consent": "COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw", - "consented_providers_settings": { - "consented_providers": [1] - } - } - }, - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/banner-no-format.json b/adapters/ix/ixtestmulti/exemplary/banner-no-format.json deleted file mode 100644 index 48a20c0ac8d..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/banner-no-format.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/max-requests.json b/adapters/ix/ixtestmulti/exemplary/max-requests.json deleted file mode 100644 index ea5032f6eff..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/max-requests.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id-1", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "id": "test-imp-id-2", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "id": "test-imp-id-3", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id-1", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "id": "test-imp-id-2", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "banner": { - "format": [ - { - "h": 600, - "w": 300 - } - ], - "h": 600, - "w": 300 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - }, - "id": "test-imp-id-3" - }, - { - "id": "test-imp-id-1", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json b/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json deleted file mode 100644 index e9af9d7fd09..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/multi-format-with-ext-prebid-type.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "multi-format-test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "multi-format-test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "v-2", - "impid": "multi-format-test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {}, - "prebid": { - "type": "video" - } - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "v-2", - "impid": "multi-format-test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {}, - "prebid": { - "type": "video" - } - } - }, - "type": "video" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json b/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json deleted file mode 100644 index fe70deaf52e..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/multi-format-with-mtype.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "multi-format-test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "multi-format-test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "v-2", - "impid": "multi-format-test-imp-id", - "mtype": 2, - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "v-2", - "impid": "multi-format-test-imp-id", - "mtype": 2, - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/multibid.json b/adapters/ix/ixtestmulti/exemplary/multibid.json deleted file mode 100644 index 8111552dd86..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/multibid.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "1", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - }, - { - "id": "2", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "1", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - }, - { - "bid": { - "id": "2", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json b/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json deleted file mode 100644 index e39667efeea..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/native-eventtrackers-compat-12.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpcalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http: //i.am.a/URL\"},\"eventtrackers\":[{\"url\":\"https://example.com/imp-2.gif\",\"event\":1,\"method\":1},{\"url\":\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\",\"event\":1,\"method\":1}],\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http: //i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\",\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\"],\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://example.com/imp-2.gif\"},{\"event\":1,\"method\":1,\"url\":\"https://x123.casalemedia.com/ifnotify?a=123&b=&c=741efbc7-f28b-5301-a18d-372a4c4226c3&d=0.123\"}]}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - }, - "type": "native" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/no-pub.json b/adapters/ix/ixtestmulti/exemplary/no-pub.json deleted file mode 100644 index 4bdb3bcbd28..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/no-pub.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "site": { - "page": "https://www.example.com/" - } - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "site": { - "page": "https://www.example.com/", - "publisher": { - "id": "569749" - } - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-audio.json b/adapters/ix/ixtestmulti/exemplary/simple-audio.json deleted file mode 100644 index c942c0615a8..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/simple-audio.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "audio": { - "mimes": [ - "audio/mp4" - ], - "protocols": [ - 9, - 10 - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "audio": { - "mimes": [ - "audio/mp4" - ], - "protocols": [ - 9, - 10 - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110" - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110" - }, - "type": "audio" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json b/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json deleted file mode 100644 index 94113960c16..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/simple-banner-multi-size.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - }, - { - "w": 300, - "h": 600 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "banner" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-native.json b/adapters/ix/ixtestmulti/exemplary/simple-native.json deleted file mode 100644 index 4f2c07f9e5d..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/simple-native.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpcalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - }, - "type": "native" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/exemplary/simple-video.json b/adapters/ix/ixtestmulti/exemplary/simple-video.json deleted file mode 100644 index 0cf488949e9..00000000000 --- a/adapters/ix/ixtestmulti/exemplary/simple-video.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "cat": [ - "IAB9-1" - ], - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json b/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json deleted file mode 100644 index e08da1e1a84..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/bad-ext-bidder.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "ext": { - "prebid": 1 - } - } - ], - "site": { - "page": "https://www.example.com/" - } - }, - "expectedMakeRequestsErrors": [ - { - "value": "json: cannot unmarshal number into Go struct field ExtImpBidder.prebid of type openrtb_ext.ExtImpPrebid", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json b/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json deleted file mode 100644 index a9a0383b1a1..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/bad-ext-ix.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "ext": { - } - } - ], - "site": { - "page": "https://www.example.com/" - } - }, - "expectedMakeRequestsErrors": [ - { - "value": "unexpected end of JSON input", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json b/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json deleted file mode 100644 index 0884dcb83eb..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/bad-imp-id.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "bad-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "unmatched impression id: bad-imp-id", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-request.json b/adapters/ix/ixtestmulti/supplemental/bad-request.json deleted file mode 100644 index 7cacff1b601..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/bad-request.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 400, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 400. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/bad-response-body.json b/adapters/ix/ixtestmulti/supplemental/bad-response-body.json deleted file mode 100644 index 9d9a47380df..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/bad-response-body.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": 1 - } - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "JSON parsing error: json: cannot unmarshal number into Go struct field BidResponse.id of type string", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json deleted file mode 100644 index 49065c22258..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-empty.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpcalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ], - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - } - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"],\"eventtrackers\":[]}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"],\"eventtrackers\":[]}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - }, - "type": "native" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json b/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json deleted file mode 100644 index 232fc65ef6d..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/native-eventtrackers-missing.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpcalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{\"assets\":[{\"id\":123,\"required\":1,\"title\":{\"text\":\"Learn about this awesome thing\"}},{\"id\":124,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/thumbnail1.png\"}},{\"id\":128,\"required\":1,\"img\":{\"url\":\"http://www.myads.com/largethumb1.png\"}},{\"id\":126,\"required\":1,\"data\":{\"value\":\"My Brand\"}},{\"id\":127,\"required\":1,\"data\":{\"value\":\"Learn all about this awesome story of someone using my product.\"}}],\"link\":{\"url\":\"http://i.am.a/URL\"},\"imptrackers\":[\"https://example.com/imp-1.gif\",\"https://example.com/imp-2.gif\"]}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - }, - "type": "native" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/native-missing.json b/adapters/ix/ixtestmulti/supplemental/native-missing.json deleted file mode 100644 index 8cc88a61b3f..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/native-missing.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpcalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "native": { - "request": "{}", - "ver": "1.1" - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id", - "price": 0.5, - "adid": "29681110", - "adm": "{\"native\":{}}", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "cat": [ - "IAB3-1" - ], - "ext": { - "ix": {} - } - }, - "type": "native" - } - ] - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/no-content.json b/adapters/ix/ixtestmulti/supplemental/no-content.json deleted file mode 100644 index 874e1a09102..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/no-content.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 204, - "body": {} - } - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/no-imp.json b/adapters/ix/ixtestmulti/supplemental/no-imp.json deleted file mode 100644 index 308decd2ccc..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/no-imp.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [] - } -} diff --git a/adapters/ix/ixtestmulti/supplemental/not-found.json b/adapters/ix/ixtestmulti/supplemental/not-found.json deleted file mode 100644 index 632deda428f..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/not-found.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ] - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id", - "banner": { - "format": [ - { - "w": 300, - "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - } - ] - } - }, - "mockResponse": { - "status": 404, - "body": {} - } - } - ], - "expectedMakeBidsErrors": [ - { - "value": "Unexpected status code: 404. Run with request.debug = 1 for more info", - "comparison": "literal" - } - ] -} diff --git a/adapters/ix/ixtestmulti/supplemental/sid.json b/adapters/ix/ixtestmulti/supplemental/sid.json deleted file mode 100644 index de0d1ca689c..00000000000 --- a/adapters/ix/ixtestmulti/supplemental/sid.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "mockBidRequest": { - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id-1", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749", - "sid": "1234" - } - } - }, - { - "id": "test-imp-id-2", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569750", - "sid": "5678" - } - } - } - ] - }, - "httpCalls": [ - { - "expectedRequest": { - "uri": "http://host/endpoint", - "body": { - "ext": { - "features": { - "pbs_handle_multi_imp_on_single_req": { - "activated": true - } - }, - "prebid": null - }, - "id": "test-request-id", - "imp": [ - { - "id": "test-imp-id-1", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569749", - "sid": "1234" - }, - "sid": "1234" - } - }, - { - "id": "test-imp-id-2", - "video": { - "mimes": [ - "video/mp4" - ], - "minduration": 15, - "maxduration": 30, - "protocols": [ - 2, - 3, - 5, - 6, - 7, - 8 - ], - "w": 940, - "h": 560 - }, - "ext": { - "bidder": { - "siteId": "569750", - "sid": "5678" - }, - "sid": "5678" - } - } - ] - } - }, - "mockResponse": { - "status": 200, - "body": { - "id": "test-request-id", - "seatbid": [ - { - "seat": "958", - "bid": [ - { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adid": "29681110", - "adm": "some-test-ad", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "h": 250, - "w": 300, - "ext": { - "ix": {} - } - } - ] - } - ], - "bidid": "5778926625248726496", - "cur": "USD" - } - } - } - ], - "expectedBidResponses": [ - { - "currency": "USD", - "bids": [ - { - "bid": { - "id": "7706636740145184841", - "impid": "test-imp-id-1", - "price": 0.5, - "adm": "some-test-ad", - "adid": "29681110", - "adomain": [ - "https://advertiser.example.com" - ], - "cid": "958", - "crid": "29681110", - "w": 300, - "h": 250, - "ext": { - "ix": {} - } - }, - "type": "video" - } - ] - } - ] -} diff --git a/static/bidder-info/mediafuse.yaml b/static/bidder-info/mediafuse.yaml index b78b21e16ea..be19cc6c68a 100644 --- a/static/bidder-info/mediafuse.yaml +++ b/static/bidder-info/mediafuse.yaml @@ -12,5 +12,5 @@ capabilities: - banner - video - native -userSync: - key: "adnxs" +# userSync: +# key: "adnxs" From 6ffa3b605c5818b1813aa88c5a7bc8ca59a2fc57 Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Wed, 14 Jun 2023 09:53:15 -0400 Subject: [PATCH 5/7] chore: small refactor --- adapters/ix/ix.go | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index ab64aa6ab9a..99abc08c1b2 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -35,10 +35,6 @@ type IxDiag struct { } func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - return handleMultiImpInSingleRequest(request, a) -} - -func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ([]*adapters.RequestData, []error) { // Multi-size banner imps are split into single-size requests. // The first size imp requests are added to the first slice. // Additional size requests are added to the second slice and are merged with the first at the end. @@ -82,7 +78,7 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( if len(bannerCopy.Format) > 1 { formats := bannerCopy.Format - // Creating additional imp from multiple formats. First format is part of original imp. Rest format will be converted to individual single imp & later request. + // Creating additional imp from multiple formats. First format is part of original imp. Rest of multiformat will be sent as multiimp. for iFmt := range formats { additionalBannerCopy := *imp.Banner additionalBannerCopy.Format = formats[iFmt : iFmt+1] @@ -96,7 +92,6 @@ func handleMultiImpInSingleRequest(request *openrtb2.BidRequest, a *IxAdapter) ( } } } - imp.Banner = &bannerCopy } originalImps = append(originalImps, imp) @@ -150,30 +145,6 @@ func parseSiteId(imp *openrtb2.Imp, siteIds []string) ([]string, error) { return siteIds, nil } -func setSitePublisherId(request *openrtb2.BidRequest, iImp int) error { - if iImp == 0 { - // first impression - create a site and pub copy - site := *request.Site - if site.Publisher == nil { - site.Publisher = &openrtb2.Publisher{} - } else { - publisher := *site.Publisher - site.Publisher = &publisher - } - request.Site = &site - } - var bidderExt adapters.ExtImpBidder - if err := json.Unmarshal(request.Imp[0].Ext, &bidderExt); err != nil { - return err - } - var ixExt openrtb_ext.ExtImpIx - if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { - return err - } - request.Site.Publisher.ID = ixExt.SiteId - return nil -} - func getBannerFormats(banner *openrtb2.Banner) []openrtb2.Format { if len(banner.Format) == 0 && banner.W != nil && banner.H != nil { banner.Format = []openrtb2.Format{{W: *banner.W, H: *banner.H}} From f9908c76775c1ef3a5dae26aba2a0c62e5cd3154 Mon Sep 17 00:00:00 2001 From: Oronno Mamun Date: Wed, 21 Jun 2023 18:03:02 -0400 Subject: [PATCH 6/7] feat: multi-size handle and set siteId properly --- adapters/ix/ix.go | 138 ++++++----- adapters/ix/ix_test.go | 6 +- ...son => multi-imp-multi-size-requests.json} | 45 ++-- .../ixtest/exemplary/multi-imp-requests.json | 72 +++++- .../ix/ixtest/exemplary/multiple-siteIds.json | 224 ++++++++++++++++++ .../exemplary/simple-banner-multi-size.json | 41 ++-- 6 files changed, 391 insertions(+), 135 deletions(-) rename adapters/ix/ixtest/exemplary/{max-requests.json => multi-imp-multi-size-requests.json} (86%) create mode 100644 adapters/ix/ixtest/exemplary/multiple-siteIds.json diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 99abc08c1b2..04b714e28c0 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -7,6 +7,7 @@ import ( "sort" "strings" + "github.com/golang/glog" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/errortypes" @@ -19,8 +20,7 @@ import ( ) type IxAdapter struct { - URI string - maxRequests int + URI string } type ExtRequest struct { @@ -30,32 +30,28 @@ type ExtRequest struct { } type IxDiag struct { - PbsV string `json:"pbsv,omitempty"` - PbjsV string `json:"pbjsv,omitempty"` + PbsV string `json:"pbsv,omitempty"` + PbjsV string `json:"pbjsv,omitempty"` + MultipleSiteIds string `json:"multipleSiteIds,omitempty"` } func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { - // Multi-size banner imps are split into single-size requests. - // The first size imp requests are added to the first slice. - // Additional size requests are added to the second slice and are merged with the first at the end. - requests := make([]*adapters.RequestData, 0, a.maxRequests) + requests := make([]*adapters.RequestData, 0, len(request.Imp)) errs := make([]error, 0) - if err := BuildIxDiag(request); err != nil { - errs = append(errs, err) - } - headers := http.Header{ "Content-Type": {"application/json;charset=utf-8"}, "Accept": {"application/json"}} - siteIds := []string{} - originalImps := make([]openrtb2.Imp, 0, len(request.Imp)) - additionalMultiSizeImps := make([]openrtb2.Imp, 0) + uniqueSiteIDs := make(map[string]struct{}) + filteredImps := make([]openrtb2.Imp, 0, len(request.Imp)) requestCopy := *request + + ixDiag := &IxDiag{} + for _, imp := range requestCopy.Imp { var err error - if siteIds, err = parseSiteId(&imp, siteIds); err != nil { + if err = parseSiteId(&imp, uniqueSiteIDs); err != nil { errs = append(errs, err) continue } @@ -75,46 +71,17 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters bannerCopy.W = openrtb2.Int64Ptr(bannerCopy.Format[0].W) bannerCopy.H = openrtb2.Int64Ptr(bannerCopy.Format[0].H) } - - if len(bannerCopy.Format) > 1 { - formats := bannerCopy.Format - // Creating additional imp from multiple formats. First format is part of original imp. Rest of multiformat will be sent as multiimp. - for iFmt := range formats { - additionalBannerCopy := *imp.Banner - additionalBannerCopy.Format = formats[iFmt : iFmt+1] - additionalBannerCopy.W = openrtb2.Int64Ptr(additionalBannerCopy.Format[0].W) - additionalBannerCopy.H = openrtb2.Int64Ptr(additionalBannerCopy.Format[0].H) - if iFmt == 0 { - bannerCopy = additionalBannerCopy - } else { - imp.Banner = &additionalBannerCopy - additionalMultiSizeImps = append(additionalMultiSizeImps, imp) - } - } - } imp.Banner = &bannerCopy } - originalImps = append(originalImps, imp) - } - - if requestCopy.Site != nil { - site := *requestCopy.Site - if site.Publisher == nil { - site.Publisher = &openrtb2.Publisher{} - } else { - publisher := *site.Publisher - site.Publisher = &publisher - } - if len(siteIds) == 1 { - site.Publisher.ID = siteIds[0] - } - requestCopy.Site = &site + filteredImps = append(filteredImps, imp) } + requestCopy.Imp = filteredImps - requestCopy.Imp = originalImps + setSitePublisherId(&requestCopy, uniqueSiteIDs, ixDiag) - if len(additionalMultiSizeImps) > 0 { - requestCopy.Imp = append(requestCopy.Imp, additionalMultiSizeImps...) + err := setIxDiagIntoExtRequest(&requestCopy, ixDiag) + if err != nil { + errs = append(errs, err) } if len(requestCopy.Imp) != 0 { @@ -128,28 +95,49 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters return requests, errs } -func parseSiteId(imp *openrtb2.Imp, siteIds []string) ([]string, error) { +func setSitePublisherId(requestCopy *openrtb2.BidRequest, uniqueSiteIDs map[string]struct{}, ixDiag *IxDiag) { + if requestCopy.Site != nil { + site := *requestCopy.Site + if site.Publisher == nil { + site.Publisher = &openrtb2.Publisher{} + } else { + publisher := *site.Publisher + site.Publisher = &publisher + } + + siteIDs := make([]string, 0, len(uniqueSiteIDs)) + for key := range uniqueSiteIDs { + siteIDs = append(siteIDs, key) + } + if len(siteIDs) == 1 { + site.Publisher.ID = siteIDs[0] + } + if len(siteIDs) > 1 { + // Sorting siteIDs for predictable output as Go maps don't guarantee order + sort.Strings(siteIDs) + multipleSiteIDs := strings.Join(siteIDs, ", ") + glog.Warningf("Multiple SiteIDs found. %s", multipleSiteIDs) + ixDiag.MultipleSiteIds = multipleSiteIDs + } + requestCopy.Site = &site + } +} + +func parseSiteId(imp *openrtb2.Imp, uniqueSiteIDs map[string]struct{}) error { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return nil, err + return err } var ixExt openrtb_ext.ExtImpIx if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { - return nil, err + return err } if ixExt.SiteId != "" { - siteIds = append(siteIds, ixExt.SiteId) - } - return siteIds, nil -} - -func getBannerFormats(banner *openrtb2.Banner) []openrtb2.Format { - if len(banner.Format) == 0 && banner.W != nil && banner.H != nil { - banner.Format = []openrtb2.Format{{W: *banner.W, H: *banner.H}} + uniqueSiteIDs[ixExt.SiteId] = struct{}{} } - return banner.Format + return nil } func createRequestData(a *IxAdapter, request *openrtb2.BidRequest, headers *http.Header) (*adapters.RequestData, error) { @@ -294,8 +282,7 @@ func getMediaTypeForBid(bid openrtb2.Bid, impMediaTypeReq map[string]openrtb_ext // Builder builds a new instance of the Ix adapter for the given bidder with the given config. func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { bidder := &IxAdapter{ - URI: config.Endpoint, - maxRequests: 20, + URI: config.Endpoint, } return bidder, nil } @@ -347,26 +334,33 @@ func marshalJsonWithoutUnicode(v interface{}) (string, error) { return strings.TrimSuffix(sb.String(), "\n"), nil } -func BuildIxDiag(request *openrtb2.BidRequest) error { +func setIxDiagIntoExtRequest(request *openrtb2.BidRequest, ixDiag *IxDiag) error { extRequest := &ExtRequest{} if request.Ext != nil { if err := json.Unmarshal(request.Ext, &extRequest); err != nil { return err } } - ixdiag := &IxDiag{} + if extRequest.Prebid != nil && extRequest.Prebid.Channel != nil { - ixdiag.PbjsV = extRequest.Prebid.Channel.Version + ixDiag.PbjsV = extRequest.Prebid.Channel.Version } // Slice commit hash out of version if strings.Contains(version.Ver, "-") { - ixdiag.PbsV = version.Ver[:strings.Index(version.Ver, "-")] + ixDiag.PbsV = version.Ver[:strings.Index(version.Ver, "-")] } else if version.Ver != "" { - ixdiag.PbsV = version.Ver + ixDiag.PbsV = version.Ver } + // Only set request.ext if ixDiag is not empty - if *ixdiag != (IxDiag{}) { - extRequest.IxDiag = ixdiag + if *ixDiag != (IxDiag{}) { + extRequest := &ExtRequest{} + if request.Ext != nil { + if err := json.Unmarshal(request.Ext, &extRequest); err != nil { + return err + } + } + extRequest.IxDiag = ixDiag extRequestJson, err := json.Marshal(extRequest) if err != nil { return err diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index fd2427691da..8544241a7ce 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -19,8 +19,6 @@ const endpoint string = "http://host/endpoint" func TestJsonSamples(t *testing.T) { if bidder, err := Builder(openrtb_ext.BidderIx, config.Adapter{Endpoint: endpoint}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}); err == nil { - ixBidder := bidder.(*IxAdapter) - ixBidder.maxRequests = 2 adapterstest.RunJSONBidderTest(t, "ixtest", bidder) } else { t.Fatalf("Builder returned unexpected error %v", err) @@ -106,7 +104,6 @@ func TestIxMakeBidsWithCategoryDuration(t *testing.T) { func TestIxMakeRequestWithGppString(t *testing.T) { bidder := &IxAdapter{} - bidder.maxRequests = 2 testGppString := "DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1YNN" @@ -256,7 +253,8 @@ func TestBuildIxDiag(t *testing.T) { for _, test := range testCases { t.Run(test.description, func(t *testing.T) { version.Ver = test.pbsVersion - err := BuildIxDiag(test.request) + ixDiag := &IxDiag{} + err := setIxDiagIntoExtRequest(test.request, ixDiag) if test.expectError { assert.NotNil(t, err) } else { diff --git a/adapters/ix/ixtest/exemplary/max-requests.json b/adapters/ix/ixtest/exemplary/multi-imp-multi-size-requests.json similarity index 86% rename from adapters/ix/ixtest/exemplary/max-requests.json rename to adapters/ix/ixtest/exemplary/multi-imp-multi-size-requests.json index b152cdbac10..4decdaf985d 100644 --- a/adapters/ix/ixtest/exemplary/max-requests.json +++ b/adapters/ix/ixtest/exemplary/multi-imp-multi-size-requests.json @@ -63,7 +63,10 @@ } } } - ] + ], + "site": { + "page": "https://www.example.com/" + } }, "httpCalls": [ { @@ -79,10 +82,12 @@ { "w": 300, "h": 250 + }, + { + "w": 300, + "h": 600 } - ], - "w": 300, - "h": 250 + ] }, "ext": { "bidder": { @@ -116,25 +121,7 @@ } }, { - "banner": { - "format": [ - { - "h": 600, - "w": 300 - } - ], - "h": 600, - "w": 300 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - }, - "id": "test-imp-id-3" - }, - { - "id": "test-imp-id-1", + "id": "test-imp-id-3", "banner": { "format": [ { @@ -151,7 +138,13 @@ } } } - ] + ], + "site": { + "page": "https://www.example.com/", + "publisher": { + "id": "569749" + } + } } }, "mockResponse": { @@ -173,7 +166,7 @@ ], "cid": "958", "crid": "29681110", - "h": 250, + "h": 600, "w": 300, "ext": { "ix": {} @@ -205,7 +198,7 @@ "cid": "958", "crid": "29681110", "w": 300, - "h": 250, + "h": 600, "ext": { "ix": {} } diff --git a/adapters/ix/ixtest/exemplary/multi-imp-requests.json b/adapters/ix/ixtest/exemplary/multi-imp-requests.json index 41cb9975800..d8d00aeea69 100644 --- a/adapters/ix/ixtest/exemplary/multi-imp-requests.json +++ b/adapters/ix/ixtest/exemplary/multi-imp-requests.json @@ -9,10 +9,6 @@ { "w": 300, "h": 250 - }, - { - "w": 300, - "h": 600 } ] }, @@ -62,6 +58,38 @@ "siteId": "569749" } } + }, + { + "id": "test-imp-id-4", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-5", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } } ] }, @@ -70,7 +98,7 @@ "expectedRequest": { "uri": "http://host/endpoint", "body": { - "id": "test-request-id", + "id": "test-request-id", "imp": [ { "id": "test-imp-id-1", @@ -116,16 +144,34 @@ } }, { - "id": "test-imp-id-3", + "banner": { + "format": [ + { + "h": 600, + "w": 300 + } + ], + "h": 600, + "w": 300 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + }, + "id": "test-imp-id-3" + }, + { + "id": "test-imp-id-4", "banner": { "format": [ { "w": 300, - "h": 600 + "h": 250 } ], "w": 300, - "h": 600 + "h": 250 }, "ext": { "bidder": { @@ -134,16 +180,16 @@ } }, { - "id": "test-imp-id-1", + "id": "test-imp-id-5", "banner": { "format": [ { "w": 300, - "h": 600 + "h": 250 } ], "w": 300, - "h": 600 + "h": 250 }, "ext": { "bidder": { @@ -173,7 +219,7 @@ ], "cid": "958", "crid": "29681110", - "h": 600, + "h": 250, "w": 300, "ext": { "ix": {} @@ -205,7 +251,7 @@ "cid": "958", "crid": "29681110", "w": 300, - "h": 600, + "h": 250, "ext": { "ix": {} } diff --git a/adapters/ix/ixtest/exemplary/multiple-siteIds.json b/adapters/ix/ixtest/exemplary/multiple-siteIds.json new file mode 100644 index 00000000000..7f4227ac4b2 --- /dev/null +++ b/adapters/ix/ixtest/exemplary/multiple-siteIds.json @@ -0,0 +1,224 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750" + } + } + }, + { + "id": "test-imp-id-3", + "banner": { + "format": [ + { + "w": 300, + "h": 600 + } + ] + }, + "ext": { + "bidder": { + "siteId": "569751" + } + } + } + ], + "site": { + "page": "https://www.example.com/" + }, + "ext": { + "prebid": { + "channel": { + "name": "web", + "version": "7.0.0" + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "http://host/endpoint", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id-1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "w": 300, + "h": 250 + }, + "ext": { + "bidder": { + "siteId": "569749" + } + } + }, + { + "id": "test-imp-id-2", + "video": { + "mimes": [ + "video/mp4" + ], + "minduration": 15, + "maxduration": 30, + "protocols": [ + 2, + 3, + 5, + 6, + 7, + 8 + ], + "w": 940, + "h": 560 + }, + "ext": { + "bidder": { + "siteId": "569750" + } + } + }, + { + "banner": { + "format": [ + { + "h": 600, + "w": 300 + } + ], + "h": 600, + "w": 300 + }, + "ext": { + "bidder": { + "siteId": "569751" + } + }, + "id": "test-imp-id-3" + } + ], + "site": { + "page": "https://www.example.com/", + "publisher": { + } + }, + "ext": { + "ixdiag": { + "multipleSiteIds": "569749, 569750, 569751", + "pbjsv": "7.0.0" + }, + "prebid": { + "channel": { + "name": "web", + "version": "7.0.0" + } + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "h": 250, + "w": 300, + "ext": { + "ix": {} + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id-1", + "price": 0.5, + "adm": "some-test-ad", + "adid": "29681110", + "adomain": [ + "https://advertiser.example.com" + ], + "cid": "958", + "crid": "29681110", + "w": 300, + "h": 250, + "ext": { + "ix": {} + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json b/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json index d996836d241..15dc3ecbb0c 100644 --- a/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json +++ b/adapters/ix/ixtest/exemplary/simple-banner-multi-size.json @@ -13,6 +13,10 @@ { "w": 300, "h": 600 + }, + { + "w": 600, + "h": 800 } ] }, @@ -22,7 +26,10 @@ } } } - ] + ], + "site": { + "page": "https://www.example.com/" + } }, "httpCalls": [ { @@ -38,28 +45,16 @@ { "w": 300, "h": 250 - } - ], - "w": 300, - "h": 250 - }, - "ext": { - "bidder": { - "siteId": "569749" - } - } - }, - { - "id": "test-imp-id", - "banner": { - "format": [ + }, { "w": 300, "h": 600 + }, + { + "w": 600, + "h": 800 } - ], - "w": 300, - "h": 600 + ] }, "ext": { "bidder": { @@ -67,7 +62,13 @@ } } } - ] + ], + "site": { + "page": "https://www.example.com/", + "publisher": { + "id": "569749" + } + } } }, "mockResponse": { From 7d7db6080f0a34caf3487727a848c0f7597d5efc Mon Sep 17 00:00:00 2001 From: Chris Corbo Date: Mon, 3 Jul 2023 09:43:40 -0400 Subject: [PATCH 7/7] chore: pr feedback --- adapters/ix/ix.go | 40 +++++++++++++++------------- adapters/ix/ix_test.go | 60 ------------------------------------------ 2 files changed, 22 insertions(+), 78 deletions(-) diff --git a/adapters/ix/ix.go b/adapters/ix/ix.go index 04b714e28c0..919f58da3b8 100644 --- a/adapters/ix/ix.go +++ b/adapters/ix/ix.go @@ -51,12 +51,19 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters for _, imp := range requestCopy.Imp { var err error - if err = parseSiteId(&imp, uniqueSiteIDs); err != nil { + ixExt, err := unmarshalToIxExt(&imp) + + if err != nil { errs = append(errs, err) continue } - if err := moveSid(&imp); err != nil { + if err = parseSiteId(ixExt, uniqueSiteIDs); err != nil { + errs = append(errs, err) + continue + } + + if err := moveSid(&imp, ixExt); err != nil { errs = append(errs, err) } @@ -123,17 +130,24 @@ func setSitePublisherId(requestCopy *openrtb2.BidRequest, uniqueSiteIDs map[stri } } -func parseSiteId(imp *openrtb2.Imp, uniqueSiteIDs map[string]struct{}) error { +func unmarshalToIxExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpIx, error) { var bidderExt adapters.ExtImpBidder if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return err + return nil, err } var ixExt openrtb_ext.ExtImpIx if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { - return err + return nil, err } + return &ixExt, nil +} + +func parseSiteId(ixExt *openrtb_ext.ExtImpIx, uniqueSiteIDs map[string]struct{}) error { + if ixExt == nil { + return fmt.Errorf("Nil Ix Ext") + } if ixExt.SiteId != "" { uniqueSiteIDs[ixExt.SiteId] = struct{}{} } @@ -371,19 +385,9 @@ func setIxDiagIntoExtRequest(request *openrtb2.BidRequest, ixDiag *IxDiag) error } // moves sid from imp[].ext.bidder.sid to imp[].ext.sid -func moveSid(imp *openrtb2.Imp) error { - if len(imp.Ext) == 0 { - return nil - } - - var bidderExt adapters.ExtImpBidder - if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil { - return err - } - - var ixExt openrtb_ext.ExtImpIx - if err := json.Unmarshal(bidderExt.Bidder, &ixExt); err != nil { - return err +func moveSid(imp *openrtb2.Imp, ixExt *openrtb_ext.ExtImpIx) error { + if ixExt == nil { + return fmt.Errorf("Nil Ix Ext") } if ixExt.Sid != "" { diff --git a/adapters/ix/ix_test.go b/adapters/ix/ix_test.go index 8544241a7ce..a64e3d0c661 100644 --- a/adapters/ix/ix_test.go +++ b/adapters/ix/ix_test.go @@ -274,63 +274,3 @@ func TestMakeRequestsErrIxDiag(t *testing.T) { _, errs := bidder.MakeRequests(req, nil) assert.Len(t, errs, 1) } - -func TestMoveSid(t *testing.T) { - testCases := []struct { - description string - imp openrtb2.Imp - expectedExt json.RawMessage - expectErr bool - }{ - { - description: "valid input with sid", - imp: openrtb2.Imp{ - Ext: json.RawMessage(`{"bidder":{"sid":"1234"}}`), - }, - expectedExt: json.RawMessage(`{"bidder":{"sid":"1234"},"sid":"1234"}`), - expectErr: false, - }, - { - description: "valid input without sid", - imp: openrtb2.Imp{ - Ext: json.RawMessage(`{"bidder":{"siteId":"1234"}}`), - }, - expectedExt: json.RawMessage(`{"bidder":{"siteId":"1234"}}`), - expectErr: false, - }, - { - description: "no ext", - imp: openrtb2.Imp{ID: "1"}, - expectedExt: nil, - expectErr: false, - }, - { - description: "malformed json", - imp: openrtb2.Imp{ - Ext: json.RawMessage(`"bidder":{"sid":"1234"}`), - }, - expectedExt: json.RawMessage(`"bidder":{"sid":"1234"}`), - expectErr: true, - }, - { - description: "malformed bidder json", - imp: openrtb2.Imp{ - Ext: json.RawMessage(`{"bidder":{"sid":1234}}`), - }, - expectedExt: json.RawMessage(`{"bidder":{"sid":1234}}`), - expectErr: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.description, func(t *testing.T) { - err := moveSid(&tc.imp) - assert.Equal(t, tc.expectedExt, tc.imp.Ext) - if tc.expectErr { - assert.NotNil(t, err) - } else { - assert.Nil(t, err) - } - }) - } -}