Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
przemkaczmarek committed Dec 10, 2024
1 parent cbd5d1c commit b16e499
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
16 changes: 9 additions & 7 deletions adapters/intertech/intertech.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,18 @@ func updateBanner(banner *openrtb2.Banner) (*openrtb2.Banner, error) {
if banner == nil {
return nil, fmt.Errorf("banner is null")
}
if banner.W == nil || banner.H == nil || *banner.W == 0 || *banner.H == 0 {
if len(banner.Format) > 0 {
w := banner.Format[0].W
h := banner.Format[0].H
banner.W = &w
banner.H = &h
bannerCopy := *banner
if bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0 {
if len(bannerCopy.Format) > 0 {
w := bannerCopy.Format[0].W
h := bannerCopy.Format[0].H
bannerCopy.W = &w
bannerCopy.H = &h
} else {
return nil, fmt.Errorf("Invalid sizes provided for Banner")
}
}
return banner, nil
return &bannerCopy, nil
}

func (a *adapter) modifyUrl(extImp ExtImpIntertech, referer, cur string) (string, error) {
Expand Down Expand Up @@ -187,6 +188,7 @@ func buildRequestData(bidRequest openrtb2.BidRequest, uri string) (*adapters.Req
Uri: uri,
Body: body,
Headers: headers,
ImpIDs: openrtb_ext.GetImpIDs(bidRequest.Imp),
}, nil
}

Expand Down
18 changes: 9 additions & 9 deletions adapters/intertech/intertechtest/exemplary/simple-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)"
},
"app": {
"id": "app_123",
"bundle": "com.example.testapp"
"site": {
"page": "mypage"
},
"imp": [
{
Expand All @@ -25,12 +24,13 @@
}
}
}
]
],
"cur": ["USD"]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=&ssp-cur=USD",
"uri": "https://test.intertech.com/ssp?pid=1001&imp=2002&target-ref=mypage&ssp-cur=USD",
"body": {
"id": "test-request-id",
"imp": [
Expand All @@ -52,14 +52,14 @@
}
}
],
"app": {
"id": "app_123",
"bundle": "com.example.testapp"
"site": {
"page": "mypage"
},
"device": {
"ip": "123.123.123.123",
"ua": "Mozilla/5.0 (iPad; CPU OS 10_3 like Mac OS X)"
}
},
"cur": ["USD"]
},
"impIDs": ["test-imp-id"]
},
Expand Down

0 comments on commit b16e499

Please sign in to comment.