Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,12 @@ private ExtImpConnatix parseExtImp(Imp imp) {
private Imp modifyImp(Imp imp, ExtImpConnatix extImpConnatix, String displayManagerVer, BidRequest request) {
final Price bidFloorPrice = resolveBidFloor(imp, request);

final ObjectNode impExt = mapper.mapper()
.createObjectNode().set("connatix", mapper.mapper().valueToTree(extImpConnatix));
final ObjectNode impExt = imp.getExt() != null
? imp.getExt().deepCopy()
: mapper.mapper().createObjectNode();

Optional.ofNullable(imp.getExt())
.map(ext -> ext.get(GPID_KEY))
.filter(JsonNode::isTextual)
.ifPresent(gpidNode -> impExt.set(GPID_KEY, gpidNode));
impExt.remove("bidder");
impExt.set("connatix", mapper.mapper().valueToTree(extImpConnatix));

return imp.toBuilder()
.ext(impExt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,12 @@ public void makeHttpRequestsShouldExcludeDataCenterWhenUserIdIsMissing() {
}

@Test
public void makeHttpRequestsShouldIncludeGpidWhenPresent() {
public void makeHttpRequestsShouldIncludeEntireImpExt() {
// given
final ObjectNode impExt = mapper.createObjectNode();
impExt.set("bidder", mapper.valueToTree(ExtImpConnatix.of("placementId", null)));
impExt.put("gpid", "test-gpid");
impExt.put("random", "test-random");

final BidRequest bidRequest = givenBidRequest(
UnaryOperator.identity(),
Expand All @@ -367,6 +368,7 @@ public void makeHttpRequestsShouldIncludeGpidWhenPresent() {
final ObjectNode expectedExt = mapper.createObjectNode();
expectedExt.set("connatix", mapper.valueToTree(ExtImpConnatix.of("placementId", null)));
expectedExt.put("gpid", "test-gpid");
expectedExt.put("random", "test-random");

assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"connatix": {
"placementId": "some-placement-id"
},
"tid": "${json-unit.any-string}",
"gpid": "test-gpid"
}
}
Expand Down
Loading