From 8b13ebcb54fbaf521665d696485b2b59986f7d54 Mon Sep 17 00:00:00 2001 From: edandavi Date: Mon, 5 Aug 2024 19:03:03 +0300 Subject: [PATCH] consumable adapter - use configured endpoint instead of hardcoded value (#3783) authored by @edandavi --- adapters/consumable/consumable.go | 6 +++--- adapters/consumable/consumable_test.go | 29 ++++++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/adapters/consumable/consumable.go b/adapters/consumable/consumable.go index dd139e58fb0..724a3d45721 100644 --- a/adapters/consumable/consumable.go +++ b/adapters/consumable/consumable.go @@ -41,7 +41,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E requests := []*adapters.RequestData{ { Method: "POST", - Uri: "https://e.serverbid.com/sb/rtb", + Uri: a.endpoint + "/sb/rtb", Body: bodyBytes, Headers: headers, ImpIDs: openrtb_ext.GetImpIDs(request.Imp), @@ -63,7 +63,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E requests := []*adapters.RequestData{ { Method: "POST", - Uri: "https://e.serverbid.com/rtb/bid?s=" + consumableExt.PlacementId, + Uri: a.endpoint + "/rtb/bid?s=" + consumableExt.PlacementId, Body: bodyBytes, Headers: headers, ImpIDs: openrtb_ext.GetImpIDs(request.Imp), @@ -71,8 +71,8 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E } return requests, errs } - } + func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { if adapters.IsResponseStatusCodeNoContent(responseData) { return nil, nil diff --git a/adapters/consumable/consumable_test.go b/adapters/consumable/consumable_test.go index f960597cff3..05fbf88da4f 100644 --- a/adapters/consumable/consumable_test.go +++ b/adapters/consumable/consumable_test.go @@ -15,7 +15,8 @@ import ( func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderConsumable, config.Adapter{ - Endpoint: "http://ib.adnxs.com/openrtb2"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) + Endpoint: "https://e.serverbid.com", + }, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) @@ -28,23 +29,25 @@ func TestConsumableMakeBidsWithCategoryDuration(t *testing.T) { bidder := &adapter{} mockedReq := &openrtb2.BidRequest{ - Imp: []openrtb2.Imp{{ - ID: "1_1", - Video: &openrtb2.Video{ - W: ptrutil.ToPtr[int64](640), - H: ptrutil.ToPtr[int64](360), - MIMEs: []string{"video/mp4"}, - MaxDuration: 60, - Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, - }, - Ext: json.RawMessage( - `{ + Imp: []openrtb2.Imp{ + { + ID: "1_1", + Video: &openrtb2.Video{ + W: ptrutil.ToPtr[int64](640), + H: ptrutil.ToPtr[int64](360), + MIMEs: []string{"video/mp4"}, + MaxDuration: 60, + Protocols: []adcom1.MediaCreativeSubtype{2, 3, 5, 6}, + }, + Ext: json.RawMessage( + `{ "prebid": {}, "bidder": { "placementId": "123456" } }`, - )}, + ), + }, }, } mockedExtReq := &adapters.RequestData{}