Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
madsenseops committed Feb 28, 2025
1 parent 2db4f8f commit c1696fb
Show file tree
Hide file tree
Showing 16 changed files with 263 additions and 20 deletions.
4 changes: 2 additions & 2 deletions adapters/madsense/madsense.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
return bidder, nil
}

func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) (requests []*adapters.RequestData, errors []error) {
func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
reqs := make([]*adapters.RequestData, 0, len(request.Imp))
var errs []error

appendReq := func(imps []openrtb2.Imp) {
req, err := a.makeRequest(request, imps)
if err != nil {
errors = append(errors, err)
errs = append(errs, err)
return
}
if req != nil {
Expand Down
2 changes: 1 addition & 1 deletion adapters/madsense/madsense_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderMadSense, config.Adapter{
Endpoint: "https://ads.madsense.io/pbs"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
Endpoint: "https://test.localhost.com"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
Expand Down
2 changes: 1 addition & 1 deletion adapters/madsense/madsensetest/exemplary/banner-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"1.2.3.4"
]
},
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"body": {
"id": "test-request-id",
"imp": [
Expand Down
17 changes: 11 additions & 6 deletions adapters/madsense/madsensetest/exemplary/banner-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
],
"device": {
"ua": "user-agent",
"ip": "1.2.3.4"
"ipv6": "2001:db8:3333:4444:5555:6666:7777:8888"
},
"site": {
"domain": "domain.com",
"page": "http://domain.com/page"
"page": "http://domain.com/page",
"ref": "https://example.com/page"
}
},
"httpCalls": [
Expand All @@ -45,10 +46,13 @@
"user-agent"
],
"X-Forwarded-For": [
"1.2.3.4"
"2001:db8:3333:4444:5555:6666:7777:8888"
],
"Referer": [
"https://example.com/page"
]
},
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"body": {
"id": "test-request-id",
"imp": [
Expand All @@ -67,11 +71,12 @@
],
"device": {
"ua": "user-agent",
"ip": "1.2.3.4"
"ipv6": "2001:db8:3333:4444:5555:6666:7777:8888"
},
"site": {
"domain": "domain.com",
"page": "http://domain.com/page"
"page": "http://domain.com/page",
"ref": "https://example.com/page"
}
},
"impIDs":["test-imp-id"]
Expand Down
4 changes: 2 additions & 2 deletions adapters/madsense/madsensetest/exemplary/mixed-imp-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down Expand Up @@ -171,7 +171,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
2 changes: 1 addition & 1 deletion adapters/madsense/madsensetest/exemplary/video-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
2 changes: 1 addition & 1 deletion adapters/madsense/madsensetest/exemplary/video-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": [
"video/mp4"
],
"w": 1920,
"h": 1080
},
"ext": {
"bidder": {
"company_id": "9876543"
}
}
}
],
"app": {
"bundle": "54321"
},
"device": {
"ip": "1.2.3.4",
"ua": "user-agent"
}
},
"httpCalls": [
{
"expectedRequest": {
"method": "POST",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json;charset=utf-8"
],
"X-Openrtb-Version": [
"2.6"
],
"User-Agent": [
"user-agent"
],
"X-Forwarded-For": [
"1.2.3.4"
]
},
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": [
"video/mp4"
],
"w": 1920,
"h": 1080
},
"ext": {
"bidder": {
"company_id": "9876543"
}
}
}
],
"device": {
"ip": "1.2.3.4",
"ua": "user-agent"
},
"app": {
"bundle": "54321"
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
"body": "invalid response"
}
}
],
"expectedMakeBidsErrors": [
{
"value": "Bad Server Response",
"comparison": "literal"
}
]
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"1.2.3.4"
]
},
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"body": {
"id": "test-request-id",
"imp": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"expectedRequest": {
"method": "POST",
"uri": "https://ads.madsense.io/pbs?company_id=9876543",
"uri": "https://test.localhost.com?company_id=9876543",
"headers": {
"Accept": [
"application/json"
Expand Down
143 changes: 143 additions & 0 deletions adapters/madsense/madsensetest/supplemental/test-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"mockBidRequest": {
"id": "test-request-id",
"test": 1,
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": [
"video/mp4"
],
"w": 1920,
"h": 1080
},
"ext": {
"bidder": {
"company_id": "9876543"
}
}
}
],
"app": {
"bundle": "54321"
},
"device": {
"ip": "1.2.3.4",
"ua": "user-agent"
}
},
"httpCalls": [
{
"expectedRequest": {
"method": "POST",
"uri": "https://test.localhost.com?company_id=test",
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json;charset=utf-8"
],
"X-Openrtb-Version": [
"2.6"
],
"User-Agent": [
"user-agent"
],
"X-Forwarded-For": [
"1.2.3.4"
]
},
"body": {
"id": "test-request-id",
"test": 1,
"imp": [
{
"id": "test-imp-id",
"video": {
"mimes": [
"video/mp4"
],
"w": 1920,
"h": 1080
},
"ext": {
"bidder": {
"company_id": "9876543"
}
}
}
],
"device": {
"ip": "1.2.3.4",
"ua": "user-agent"
},
"app": {
"bundle": "54321"
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"cur": "USD",
"seatbid": [
{
"bid": [
{
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 10,
"adm": "some-test-ad",
"crid": "54321",
"w": 1920,
"h": 1080,
"mtype": 2,
"dur": 15,
"cat": [
"IAB1-5",
"IAB1-6"
]
}
],
"seat": "madsense"
}
]
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "8ee514f1-b2b8-4abb-89fd-084437d1e800",
"impid": "test-imp-id",
"price": 10,
"adm": "some-test-ad",
"crid": "54321",
"w": 1920,
"h": 1080,
"mtype": 2,
"dur": 15,
"cat": [
"IAB1-5",
"IAB1-6"
]
},
"type": "video",
"video": {
"duration": 15,
"primary_category": "IAB1-5"
}
}
]
}
]
}

Loading

0 comments on commit c1696fb

Please sign in to comment.