Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream-vanilla/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-nilesh-chate committed Feb 22, 2024
2 parents f9969ab + 5900d36 commit cb5ff78
Show file tree
Hide file tree
Showing 16 changed files with 1,438 additions and 161 deletions.
20 changes: 10 additions & 10 deletions adapters/adoppler/adoppler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (ads *AdopplerAdapter) MakeRequests(
for _, imp := range req.Imp {
ext, err := unmarshalExt(imp.Ext)
if err != nil {
errs = append(errs, &errortypes.BadInput{err.Error()})
errs = append(errs, &errortypes.BadInput{Message: err.Error()})
continue
}

Expand All @@ -83,7 +83,7 @@ func (ads *AdopplerAdapter) MakeRequests(
if err != nil {
e := fmt.Sprintf("Unable to build bid URI: %s",
err.Error())
errs = append(errs, &errortypes.BadInput{e})
errs = append(errs, &errortypes.BadInput{Message: e})
continue
}
data := &adapters.RequestData{
Expand All @@ -110,11 +110,11 @@ func (ads *AdopplerAdapter) MakeBids(
return nil, nil
}
if resp.StatusCode == http.StatusBadRequest {
return nil, []error{&errortypes.BadInput{"bad request"}}
return nil, []error{&errortypes.BadInput{Message: "bad request"}}
}
if resp.StatusCode != http.StatusOK {
err := &errortypes.BadServerResponse{
fmt.Sprintf("unexpected status: %d", resp.StatusCode),
Message: fmt.Sprintf("unexpected status: %d", resp.StatusCode),
}
return nil, []error{err}
}
Expand All @@ -123,7 +123,7 @@ func (ads *AdopplerAdapter) MakeBids(
err := json.Unmarshal(resp.Body, &bidResp)
if err != nil {
err := &errortypes.BadServerResponse{
fmt.Sprintf("invalid body: %s", err.Error()),
Message: fmt.Sprintf("invalid body: %s", err.Error()),
}
return nil, []error{err}
}
Expand All @@ -132,7 +132,7 @@ func (ads *AdopplerAdapter) MakeBids(
for _, imp := range intReq.Imp {
if _, ok := impTypes[imp.ID]; ok {
return nil, []error{&errortypes.BadInput{
fmt.Sprintf("duplicate $.imp.id %s", imp.ID),
Message: fmt.Sprintf("duplicate $.imp.id %s", imp.ID),
}}
}
if imp.Banner != nil {
Expand All @@ -145,7 +145,7 @@ func (ads *AdopplerAdapter) MakeBids(
impTypes[imp.ID] = openrtb_ext.BidTypeNative
} else {
return nil, []error{&errortypes.BadInput{
"one of $.imp.banner, $.imp.video, $.imp.audio and $.imp.native field required",
Message: "one of $.imp.banner, $.imp.video, $.imp.audio and $.imp.native field required",
}}
}
}
Expand All @@ -156,7 +156,7 @@ func (ads *AdopplerAdapter) MakeBids(
tp, ok := impTypes[bid.ImpID]
if !ok {
err := &errortypes.BadServerResponse{
fmt.Sprintf("unknown impid: %s", bid.ImpID),
Message: fmt.Sprintf("unknown impid: %s", bid.ImpID),
}
return nil, []error{err}
}
Expand All @@ -165,11 +165,11 @@ func (ads *AdopplerAdapter) MakeBids(
if tp == openrtb_ext.BidTypeVideo {
adsExt, err := unmarshalAdsExt(bid.Ext)
if err != nil {
return nil, []error{&errortypes.BadServerResponse{err.Error()}}
return nil, []error{&errortypes.BadServerResponse{Message: err.Error()}}
}
if adsExt == nil || adsExt.Video == nil {
return nil, []error{&errortypes.BadServerResponse{
"$.seatbid.bid.ext.ads.video required",
Message: "$.seatbid.bid.ext.ads.video required",
}}
}
bidVideo = &openrtb_ext.ExtBidPrebidVideo{
Expand Down
2 changes: 1 addition & 1 deletion adapters/adquery/adquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, _ *adapters.ExtraRe
for _, imp := range request.Imp {
ext, err := parseExt(imp.Ext)
if err != nil {
errs = append(errs, &errortypes.BadInput{err.Error()})
errs = append(errs, &errortypes.BadInput{Message: err.Error()})
continue
}

Expand Down
193 changes: 193 additions & 0 deletions adapters/ix/ixtest/supplemental/dsa-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"bidder": {
"siteId": "569749"
}
}
}
],
"regs": {
"ext": {
"dsa": {
"dsarequired": 3,
"pubrender": 0,
"datatopub": 2,
"transparency": [
{
"domain": "platform1domain.com",
"dsaparams": [
1
]
},
{
"domain": "SSP2domain.com",
"dsaparams": [
1,
2
]
}
]
}
}
},
"site": {
"page": "https://www.example.com/"
}
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://host/endpoint",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
],
"w": 300,
"h": 250
},
"ext": {
"bidder": {
"siteId": "569749"
}
}
}
],
"site": {
"page": "https://www.example.com/",
"publisher": {
"id": "569749"
}
},
"regs": {
"ext": {
"dsa": {
"dsarequired": 3,
"pubrender": 0,
"datatopub": 2,
"transparency": [
{
"domain": "platform1domain.com",
"dsaparams": [
1
]
},
{
"domain": "SSP2domain.com",
"dsaparams": [
1,
2
]
}
]
}
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "test-request-id",
"seatbid": [
{
"seat": "958",
"bid": [
{
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adid": "29681110",
"adm": "some-test-ad",
"adomain": [
"https://advertiser.example.com"
],
"cid": "958",
"crid": "29681110",
"h": 250,
"w": 300,
"ext": {
"ix": {},
"dsa": {
"behalf": "Advertiser",
"paid": "Advertiser",
"transparency": {
"domain": "dsp1domain.com",
"params": [
1,
2
]
},
"adrender": 1
}
}
}
]
}
],
"bidid": "5778926625248726496",
"cur": "USD"
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "7706636740145184841",
"impid": "test-imp-id",
"price": 0.5,
"adm": "some-test-ad",
"adid": "29681110",
"adomain": [
"https://advertiser.example.com"
],
"cid": "958",
"crid": "29681110",
"w": 300,
"h": 250,
"ext": {
"ix": {},
"dsa": {
"behalf": "Advertiser",
"paid": "Advertiser",
"transparency": {
"domain": "dsp1domain.com",
"params": [
1,
2
]
},
"adrender": 1
}
}
},
"type": "banner"
}
]
}
]
}
4 changes: 2 additions & 2 deletions amp/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ReadPolicy(ampParams Params, pbsConfigGDPREnabled bool) (privacy.PolicyWrit
warningMsg = validateTCf2ConsentString(ampParams.Consent)
}
case ConsentUSPrivacy:
rv = ccpa.ConsentWriter{ampParams.Consent}
rv = ccpa.ConsentWriter{Consent: ampParams.Consent}
if ccpa.ValidateConsent(ampParams.Consent) {
if parseGdprApplies(ampParams.GdprApplies) == 1 {
// Log warning because AMP request comes with both a valid CCPA string and gdpr_applies set to true
Expand All @@ -85,7 +85,7 @@ func ReadPolicy(ampParams Params, pbsConfigGDPREnabled bool) (privacy.PolicyWrit
}
default:
if ccpa.ValidateConsent(ampParams.Consent) {
rv = ccpa.ConsentWriter{ampParams.Consent}
rv = ccpa.ConsentWriter{Consent: ampParams.Consent}
if parseGdprApplies(ampParams.GdprApplies) == 1 {
warningMsg = "AMP request gdpr_applies value was ignored because provided consent string is a CCPA consent string"
}
Expand Down
Loading

0 comments on commit cb5ff78

Please sign in to comment.