Skip to content

Commit

Permalink
Support Imp.ext.tid as not a bidder properties object. (#1947)
Browse files Browse the repository at this point in the history
* Support `Imp.ext.tid` as not a bidder properties object.

* Add functional test

* Add tid property to the model

Co-authored-by: Oleksandr Zhevedenko <net.burst.mail@gmail.com>
  • Loading branch information
CTMBNara and Net-burst authored Jul 15, 2022
1 parent df6e918 commit a264a2b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class Ortb2ImplicitParametersResolver {
private static final String BIDDER_EXT = "bidder";

private static final Set<String> IMP_EXT_NON_BIDDER_FIELDS =
Set.of(PREBID_EXT, "context", "all", "general", "skadn", "data", "gpid");
Set.of(PREBID_EXT, "context", "all", "general", "skadn", "data", "gpid", "tid");

private final boolean shouldCacheOnlyWinningBids;
private final String adServerCurrency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ImpExt {
AppNexus appNexus
ImpExtContext context
ImpExtContextData data
String tid

static ImpExt getDefaultImpExt() {
new ImpExt().tap {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.prebid.server.functional.tests

import io.qameta.allure.Issue
import org.prebid.server.functional.model.bidder.BidderName
import org.prebid.server.functional.model.bidder.Generic
import org.prebid.server.functional.model.db.Account
import org.prebid.server.functional.model.db.StoredRequest
Expand Down Expand Up @@ -566,7 +565,7 @@ class BidderParamsSpec extends BaseSpec {
def "PBS should request to bidder with header Content-Encoding = gzip when adapters.BIDDER.endpoint-compression = gzip"() {
given: "PBS with adapter configuration"
def compressionType = GZIP.value
def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled": "true",
def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled" : "true",
"adapters.generic.endpoint-compression": compressionType])

and: "Default bid request"
Expand All @@ -582,7 +581,7 @@ class BidderParamsSpec extends BaseSpec {

def "PBS should send request to bidder without header Content-Encoding when adapters.BIDDER.endpoint-compression = none"() {
given: "PBS with adapter configuration"
def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled": "true",
def pbsService = pbsServiceFactory.getService(["adapters.generic.enabled" : "true",
"adapters.generic.endpoint-compression": NONE.value])

and: "Default bid request"
Expand All @@ -595,4 +594,18 @@ class BidderParamsSpec extends BaseSpec {
assert !response.ext?.debug?.httpcalls?.get(GENERIC.value)?.requestHeaders?.first()
?.get(CONTENT_ENCODING_HEADER)
}

def "PBS should not treat reserved imp[].ext.tid object as a bidder"() {
given: "Default basic BidRequest with imp[].ext.tid object"
def bidRequest = BidRequest.defaultBidRequest
def tid = PBSUtils.getRandomString()
bidRequest.imp.first().ext.tid = tid

when: "PBS processes auction request"
defaultPbsService.sendAuctionRequest(bidRequest)

then: "imp[].ext.tid object should be passed to a bidder"
def bidderRequest = bidder.getBidderRequest(bidRequest.id)
assert bidderRequest.imp?.first()?.ext?.tid == tid
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ public void shouldMoveBidderParametersToImpExtPrebidBidderAndMergeWithExisting()
.put("skadn-data", "skadn-value"))
.<ObjectNode>set("data", mapper.createObjectNode()
.put("data-data", "data-value"))
.<ObjectNode>set("gpid", mapper.createObjectNode()
.put("gpid-data", "gpid-value"))
.<ObjectNode>set("tid", mapper.createObjectNode()
.put("tid-data", "tid-value"))
.set("prebid", mapper.createObjectNode()
.<ObjectNode>set("bidder", mapper.createObjectNode()
.set("bidder2", mapper.createObjectNode().put("param22", "value22")))
Expand All @@ -1004,6 +1008,10 @@ public void shouldMoveBidderParametersToImpExtPrebidBidderAndMergeWithExisting()
.put("skadn-data", "skadn-value"))
.<ObjectNode>set("data", mapper.createObjectNode()
.put("data-data", "data-value"))
.<ObjectNode>set("gpid", mapper.createObjectNode()
.put("gpid-data", "gpid-value"))
.<ObjectNode>set("tid", mapper.createObjectNode()
.put("tid-data", "tid-value"))
.set("prebid", mapper.createObjectNode()
.<ObjectNode>set("bidder", mapper.createObjectNode()
.<ObjectNode>set(
Expand Down

0 comments on commit a264a2b

Please sign in to comment.