Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Consumable: Use configured endpoint instead of hardcoded value #3783

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading