Skip to content

Commit

Permalink
consumable adapter - use configured endpoint instead of hardcoded val…
Browse files Browse the repository at this point in the history
…ue (#3783)

authored by @edandavi
  • Loading branch information
edandavi authored Aug 5, 2024
1 parent 7c92e10 commit 8b13ebc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions adapters/consumable/consumable.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -63,16 +63,16 @@ 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),
},
}
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
Expand Down
29 changes: 16 additions & 13 deletions adapters/consumable/consumable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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{}
Expand Down

0 comments on commit 8b13ebc

Please sign in to comment.