Skip to content

Commit a2e96a9

Browse files
committed
support ix imp level endpoint
1 parent f9529fd commit a2e96a9

File tree

3 files changed

+13
-117
lines changed

3 files changed

+13
-117
lines changed

.github/workflows/adapter-code-coverage.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

adapters/ix/ix.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters
5353

5454
ixDiagFields := make(map[string]interface{})
5555

56+
impEndPoint := ""
5657
for _, imp := range requestCopy.Imp {
5758
var err error
5859
ixExt, err := unmarshalToIxExt(&imp)
@@ -67,6 +68,7 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters
6768
continue
6869
}
6970

71+
impEndPoint = ixExt.Endpoint
7072
if err := moveSid(&imp, ixExt); err != nil {
7173
errs = append(errs, err)
7274
}
@@ -96,7 +98,7 @@ func (a *IxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters
9698
}
9799

98100
if len(requestCopy.Imp) != 0 {
99-
if requestData, err := createRequestData(a, &requestCopy, &headers); err == nil {
101+
if requestData, err := createRequestData(a, &requestCopy, &headers, impEndPoint); err == nil {
100102
requests = append(requests, requestData)
101103
} else {
102104
errs = append(errs, err)
@@ -172,11 +174,15 @@ func parseSiteId(ixExt *openrtb_ext.ExtImpIx, uniqueSiteIDs map[string]struct{})
172174
return nil
173175
}
174176

175-
func createRequestData(a *IxAdapter, request *openrtb2.BidRequest, headers *http.Header) (*adapters.RequestData, error) {
177+
func createRequestData(a *IxAdapter, request *openrtb2.BidRequest, headers *http.Header, impEndpoint string) (*adapters.RequestData, error) {
176178
body, err := json.Marshal(request)
179+
endPoint := a.URI
180+
if len(impEndpoint) > 0 {
181+
endPoint = impEndpoint
182+
}
177183
return &adapters.RequestData{
178184
Method: "POST",
179-
Uri: a.URI,
185+
Uri: endPoint,
180186
Body: body,
181187
Headers: *headers,
182188
ImpIDs: openrtb_ext.GetImpIDs(request.Imp),

openrtb_ext/imp_ix.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package openrtb_ext
22

33
// ExtImpIx defines the contract for bidrequest.imp[i].ext.prebid.bidder.ix
44
type ExtImpIx struct {
5-
SiteId string `json:"siteId"`
6-
Size []int `json:"size"`
7-
Sid string `json:"sid"`
5+
SiteId string `json:"siteId"`
6+
Size []int `json:"size"`
7+
Sid string `json:"sid"`
8+
Endpoint string `json:"ix_endpoint"`
89
}

0 commit comments

Comments
 (0)