Skip to content

Commit

Permalink
AMX Bid Adapter: Loop Variable Bug (prebid#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjacob authored and shunj-nb committed Nov 8, 2022
1 parent 7b5995b commit 8dbfac0
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 8 deletions.
6 changes: 4 additions & 2 deletions adapters/amx/amx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
const vastImpressionFormat = "<Impression><![CDATA[%s]]></Impression>"
const vastSearchPoint = "</Impression>"
const nbrHeaderName = "x-nbr"
const adapterVersion = "pbs1.0"
const adapterVersion = "pbs1.1"

// AMXAdapter is the AMX bid adapter
type AMXAdapter struct {
Expand Down Expand Up @@ -149,6 +149,7 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest

for _, sb := range bidResp.SeatBid {
for _, bid := range sb.Bid {
bid := bid
bidExt, bidExtErr := getBidExt(bid.Ext)
if bidExtErr != nil {
errs = append(errs, bidExtErr)
Expand All @@ -165,11 +166,12 @@ func (adapter *AMXAdapter) MakeBids(request *openrtb.BidRequest, externalRequest
// remove the NURL so a client/player doesn't fire it twice
b.Bid.NURL = ""
}

bidResponse.Bids = append(bidResponse.Bids, b)
}
}
return bidResponse, errs

return bidResponse, errs
}

func getBidExt(ext json.RawMessage) (amxBidExt, error) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/exemplary/app-simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"app": {
"bundle": "639881495",
Expand Down
292 changes: 292 additions & 0 deletions adapters/amx/amxtest/exemplary/display-multiple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
{
"mockBidRequest": {
"device": {
"dnt": 0,
"h": 1120,
"ip": "98.249.0.0",
"language": "en",
"os": "macos",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36",
"w": 1792
},
"id": "TL3JS6F43CKNDQFY",
"imp": [
{
"banner": {
"format": [
{
"h": 600,
"w": 300
}
],
"h": 600,
"pos": 1,
"w": 300
},
"ext": {
"bidder": {
"tagId": "cHJlYmlkLm9yZw"
}
},
"tagid": "example-tag-id",
"id": "1",
"secure": 1
}
],
"regs": {
"ext": {
"gdpr": 0,
"us_privacy": "1---"
}
},
"site": {
"domain": "www.example.com",
"ext": {
"amp": 0
},
"publisher": {
"id": "unused_publisher_id"
},
"page": "https://www.example.com/es6/es6_objects.htm",
"ref": "https://www.example.com/es6/es6_objects.htm"
},
"source": {
"ext": {
"schain": {
"complete": 1,
"nodes": [
{
"asi": "amxrtb.com",
"hp": 1,
"sid": "1234"
}
],
"ver": "1.0"
}
}
},
"test": 0,
"tmax": 300,
"user": {
"ext": {
"eids": [
{
"source": "amxid",
"uids": [
{
"atype": 1,
"id": "88de601e-3d98-48e7-81d7-00000000"
}
]
},
{
"source": "adserver.org",
"uids": [
{
"id": "1234567",
"ext": {
"rtiPartner": "TDID"
}
}
]
}
],
"gdpr": 0,
"us_privacy": "1---"
}
}
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
"h": 1120,
"ip": "98.249.0.0",
"language": "en",
"os": "macos",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36",
"w": 1792
},
"id": "TL3JS6F43CKNDQFY",
"imp": [
{
"banner": {
"format": [
{
"h": 600,
"w": 300
}
],
"h": 600,
"pos": 1,
"w": 300
},
"ext": {
"bidder": {
"tagId": "cHJlYmlkLm9yZw"
}
},
"tagid": "example-tag-id",
"id": "1",
"secure": 1
}
],
"regs": {
"ext": {
"gdpr": 0,
"us_privacy": "1---"
}
},
"site": {
"domain": "www.example.com",
"ext": {
"amp": 0
},
"publisher": {
"id": "cHJlYmlkLm9yZw"
},
"page": "https://www.example.com/es6/es6_objects.htm",
"ref": "https://www.example.com/es6/es6_objects.htm"
},
"source": {
"ext": {
"schain": {
"complete": 1,
"nodes": [
{
"asi": "amxrtb.com",
"hp": 1,
"sid": "1234"
}
],
"ver": "1.0"
}
}
},
"tmax": 300,
"user": {
"ext": {
"eids": [
{
"source": "amxid",
"uids": [
{
"atype": 1,
"id": "88de601e-3d98-48e7-81d7-00000000"
}
]
},
{
"source": "adserver.org",
"uids": [
{
"id": "1234567",
"ext": {
"rtiPartner": "TDID"
}
}
]
}
],
"gdpr": 0,
"us_privacy": "1---"
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"cur": "USD",
"id": "os4jorvupkyaa===",
"seatbid": [
{
"bid": [
{
"adid": "253510977",
"adm": "<i></i><script>_c=[];</script><script src=\"https://assets.a-mo.net/js/c.js\"></script>",
"adomain": [
"dell.com.au"
],
"cid": "668",
"crid": "253510977",
"ext": {
},
"h": 250,
"id": "8911104898220857797",
"impid": "6a362d3a9db4eba300x250",
"nurl": "https://1x1.a-mo.net/hbx/bwin",
"price": 0.50,
"w": 300
},
{
"adid": "253510977",
"adm": "<i></i><script>_c=[];</script><script src=\"https://assets.a-mo.net/js/c.js\"></script>",
"adomain": [
"dell.com.au"
],
"cid": "668",
"crid": "253510977",
"ext": {},
"h": 250,
"id": "430444686086263488",
"impid": "6a362d3a9db4eba300x250",
"nurl": "https://1x1.a-mo.net/hbx/bwin",
"price": 0.50,
"w": 300
}
],
"group": 0
}
]
}
}
}],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"adid": "253510977",
"adm": "<i></i><script>_c=[];</script><script src=\"https://assets.a-mo.net/js/c.js\"></script>",
"adomain": [
"dell.com.au"
],
"cid": "668",
"crid": "253510977",
"ext": {},
"h": 250,
"id": "8911104898220857797",
"impid": "6a362d3a9db4eba300x250",
"nurl": "https://1x1.a-mo.net/hbx/bwin",
"price": 0.50,
"w": 300
},
"type": "banner"
},
{
"bid": {
"adid": "253510977",
"adm": "<i></i><script>_c=[];</script><script src=\"https://assets.a-mo.net/js/c.js\"></script>",
"adomain": [
"dell.com.au"
],
"cid": "668",
"crid": "253510977",
"ext": {},
"h": 250,
"id": "430444686086263488",
"impid": "6a362d3a9db4eba300x250",
"nurl": "https://1x1.a-mo.net/hbx/bwin",
"price": 0.50,
"w": 300
},
"type": "banner"
}
]
}
]
}
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/exemplary/video-simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
Expand Down
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/exemplary/web-simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
Expand Down
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/supplemental/204-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
Expand Down
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/supplemental/400-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
Expand Down
2 changes: 1 addition & 1 deletion adapters/amx/amxtest/supplemental/500-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"httpCalls": [{
"expectedRequest": {
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.0",
"uri": "http://pbs-dev.amxrtb.com/auction/openrtb?v=pbs1.1",
"body": {
"device": {
"dnt": 0,
Expand Down

0 comments on commit 8dbfac0

Please sign in to comment.