Skip to content

Commit bd3f8d5

Browse files
Onetag: imp.ext read generalization (#4446)
Co-authored-by: lorenzob <l.baglini@onetag.com>
1 parent c6bf80c commit bd3f8d5

File tree

8 files changed

+108
-7
lines changed

8 files changed

+108
-7
lines changed

adapters/onetag/onetag.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
3434

3535
func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
3636
pubID := ""
37-
for idx, imp := range request.Imp {
37+
for _, imp := range request.Imp {
3838
onetagExt, err := getImpressionExt(imp)
3939
if err != nil {
4040
return nil, []error{err}
@@ -52,7 +52,6 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
5252
Message: "The publisher ID must not be empty",
5353
}}
5454
}
55-
request.Imp[idx].Ext = onetagExt.Ext
5655
}
5756

5857
url, err := a.buildEndpointURL(pubID)

adapters/onetag/onetagtest/exemplary/no-bid.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
],
6464
"w": 1024,
6565
"h": 576
66+
},
67+
"ext": {
68+
"bidder": {
69+
"pubId": "386276e072"
70+
}
6671
}
6772
}
6873
]

adapters/onetag/onetagtest/exemplary/simple-banner.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@
7474
"w": 300,
7575
"pos": 1
7676
},
77-
"bidfloor": 0.05
77+
"bidfloor": 0.05,
78+
"ext": {
79+
"bidder": {
80+
"pubId": "386276e072"
81+
}
82+
}
7883
},
7984
{
8085
"id": "121-dt2",
@@ -85,8 +90,13 @@
8590
},
8691
"bidfloor": 0.12,
8792
"ext": {
88-
"key1": "value1",
89-
"key2": "value2"
93+
"bidder": {
94+
"pubId": "386276e072",
95+
"ext": {
96+
"key1": "value1",
97+
"key2": "value2"
98+
}
99+
}
90100
}
91101
}
92102
],

adapters/onetag/onetagtest/exemplary/simple-native.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
"request":"{\"adunit\":2,\"assets\":[{\"id\":3,\"img\":{\"h\":120,\"hmin\":0,\"type\":3,\"w\":180,\"wmin\":0},\"required\":1},{\"id\":0,\"required\":1,\"title\":{\"len\":25}},{\"data\":{\"len\":25,\"type\":1},\"id\":4,\"required\":1},{\"data\":{\"len\":140,\"type\":2},\"id\":6,\"required\":1}],\"context\":1,\"layout\":1,\"contextsubtype\":11,\"plcmtcnt\":1,\"plcmttype\":2,\"ver\":\"1.1\",\"ext\":{\"banner\":{\"w\":320,\"h\":50}}}"
5757
},
5858
"ext": {
59-
"key1": "value1"
59+
"bidder": {
60+
"pubId": "386276e072",
61+
"ext": {
62+
"key1": "value1"
63+
}
64+
}
6065
}
6166
}
6267
],

adapters/onetag/onetagtest/exemplary/simple-video.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
],
6464
"w": 1024,
6565
"h": 576
66+
},
67+
"ext": {
68+
"bidder": {
69+
"pubId": "386276e072"
70+
}
6671
}
6772
}
6873
]
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"mockBidRequest": {
3+
"id": "test-request-id",
4+
"imp": [
5+
{
6+
"id": "test-imp-id",
7+
"banner": {
8+
"format": [
9+
{
10+
"w": 300,
11+
"h": 250
12+
}
13+
]
14+
},
15+
"ext": {
16+
"gpid": "test-gpid",
17+
"bidder": {
18+
"pubId": "386276e072"
19+
}
20+
}
21+
}
22+
],
23+
"site": {
24+
"id": "test-site-id"
25+
}
26+
},
27+
"httpCalls": [
28+
{
29+
"expectedRequest": {
30+
"uri": "https://example.com/prebid-server/386276e072",
31+
"body": {
32+
"id": "test-request-id",
33+
"imp": [
34+
{
35+
"id": "test-imp-id",
36+
"banner": {
37+
"format": [
38+
{
39+
"w": 300,
40+
"h": 250
41+
}
42+
]
43+
},
44+
"ext": {
45+
"gpid": "test-gpid",
46+
"bidder": {
47+
"pubId": "386276e072"
48+
}
49+
}
50+
}
51+
],
52+
"site": {
53+
"id": "test-site-id"
54+
}
55+
},
56+
"impIDs": [
57+
"test-imp-id"
58+
]
59+
},
60+
"mockResponse": {
61+
"status": 204,
62+
"body": {}
63+
}
64+
}
65+
],
66+
"expectedBidResponses": []
67+
}

adapters/onetag/onetagtest/supplemental/internal-server-error.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
],
6464
"w": 1024,
6565
"h": 576
66+
},
67+
"ext": {
68+
"bidder": {
69+
"pubId": "386276e072"
70+
}
6671
}
6772
}
6873
]

adapters/onetag/onetagtest/supplemental/wrong-impression-id.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@
5656
"w": 300,
5757
"pos": 1
5858
},
59-
"bidfloor": 0.05
59+
"bidfloor": 0.05,
60+
"ext": {
61+
"bidder": {
62+
"pubId": "386276e072"
63+
}
64+
}
6065
}
6166
],
6267
"site": {

0 commit comments

Comments
 (0)