Skip to content

Commit

Permalink
Richaudience: Shared memory fix (#2710)
Browse files Browse the repository at this point in the history
* Shared memory fix

* Minor reference usage fix

* Removed empty lines

* Code review feedback addressed

* Added nil check for req.device
  • Loading branch information
VeronikaSolovei9 committed May 1, 2023
1 parent e18f17f commit a2fadfb
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 25 deletions.
13 changes: 13 additions & 0 deletions adapters/richaudience/richaudience.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
}

if request.App != nil {
appCopy := *request.App
request.App = &appCopy

request.App.Keywords = "tagid=" + imp.TagID
}

if request.Site != nil {
siteCopy := *request.Site
request.Site = &siteCopy

request.Site.Keywords = "tagid=" + imp.TagID
}

Expand All @@ -65,6 +71,13 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
}

if raiExt.Test {
if request.Device != nil {
deviceCopy := *request.Device
request.Device = &deviceCopy
} else {
request.Device = &openrtb2.Device{}
}

request.Device.IP = "11.222.33.44"
request.Test = int8(1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"bidfloor": 1e-05,
"bidfloorcur": "USD",
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
Expand All @@ -24,7 +25,6 @@
],
"app": {
"id": "12345678",
"keywords": "tagid=",
"name": "Richaudience TV",
"bundle": "R12345678901011",
"publisher": {
Expand All @@ -41,7 +41,7 @@
}
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ifa": "zxcjbzxmc-zxcbmz-zxbcz-zxczx"
},
"user": {
Expand Down Expand Up @@ -86,7 +86,7 @@
],
"app": {
"id": "12345678",
"keywords": "tagid=",
"keywords": "tagid=testTag",
"name": "Richaudience TV",
"bundle": "R12345678901011",
"publisher": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
]
},
"bidfloor": 1e-05,
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
Expand All @@ -24,12 +25,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down Expand Up @@ -80,7 +80,7 @@
}
],
"site": {
"keywords": "tagid=",
"keywords": "tagid=testTag",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"bidfloor": 1e-05,
"bidfloorcur": "USD",
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
Expand All @@ -23,14 +24,13 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"dnt": 1,
"lmt": 1,
"ip": "11.222.33.44"
"ip": "10.20.30.40"
},
"user": {
"buyeruid": "189f4055-78a3-46eb-b7fd-0915a1a43bd2a",
Expand Down Expand Up @@ -73,7 +73,7 @@
}
],
"site": {
"keywords": "tagid=",
"keywords": "tagid=testTag",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ipv6": "2607:fb90:f27:4512:d800:cb23:a603:e245",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"mockBidRequest": {
"id": "4d3f84eb-787b-42fb-a0cf-062690dadce3",
"test": 0,
"imp": [
{
"id": "div-gpt-ad-1460505748561-0",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"bidfloor": 1e-05,
"bidfloorcur": "USD",
"tagid": "testTag",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
"supplyType": "site",
"test": true
}
}
}
],
"app": {
"id": "12345678",
"name": "Richaudience TV",
"bundle": "R12345678901011",
"publisher": {
"id": "1234567",
"ext": {
"prebid": {
"parentAccount": "891011"
}
}
},
"content": {
"title": "Richaudience TV",
"series": "Richaudience TV"
}
},
"user": {
"buyeruid": "189f4055-78a3-46eb-b7fd-0915a1a43bd2a",
"ext": {}
}
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://ortb.richaudience.com/ortb/?bidder=pbs",
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
],
"X-Openrtb-Version": [
"2.5"
]
},
"body": {
"id": "4d3f84eb-787b-42fb-a0cf-062690dadce3",
"test": 1,
"imp": [
{
"id": "div-gpt-ad-1460505748561-0",
"tagid": "OsNsyeF68q",
"secure": 0,
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"bidfloor": 1e-05,
"bidfloorcur": "USD",
"ext": {
"bidder": {
"pid": "OsNsyeF68q",
"supplyType": "site",
"test": true
}
}
}
],
"app": {
"id": "12345678",
"keywords": "tagid=testTag",
"name": "Richaudience TV",
"bundle": "R12345678901011",
"publisher": {
"id": "1234567",
"ext": {
"prebid": {
"parentAccount": "891011"
}
}
},
"content": {
"title": "Richaudience TV",
"series": "Richaudience TV"
}
},
"device": {
"ip": "11.222.33.44"
},
"user": {
"buyeruid": "189f4055-78a3-46eb-b7fd-0915a1a43bd2a",
"ext": {
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "ff935bea-4661-40bf-95b7-80c354cf0cdc",
"seatbid": [
{
"bid": [
{
"id": "47286888",
"impid": "div-gpt-ad-1460505748561-0",
"price": 99,
"crid": "999999",
"adm": "<!-- creative -->",
"adomain": [
"richaudience.com"
],
"h": 250,
"w": 300
}
]
}
]
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "47286888",
"impid": "div-gpt-ad-1460505748561-0",
"price": 99,
"adm": "<!-- creative -->",
"adomain": [
"richaudience.com"
],
"crid": "999999",
"w": 300,
"h": 250
},
"type": "banner"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "http://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
}
],
"site": {
"keywords": "tagid=",
"domain": "bridge.richmediastudio.com",
"page": "https://bridge.richmediastudio.com//ab083674fb8200b877a6983126e4477d/PrebidServer/indexRa.html?pbjs_debug=true"
},
"device": {
"ip": "11.222.33.44",
"ip": "10.20.30.40",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
},
"user": {
Expand Down
Loading

0 comments on commit a2fadfb

Please sign in to comment.