Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.prebid.server.auction.aliases.BidderAliases;
import org.prebid.server.auction.ImplicitParametersExtractor;
import org.prebid.server.auction.IpAddressHelper;
import org.prebid.server.auction.PriceGranularity;
import org.prebid.server.auction.SecBrowsingTopicsResolver;
import org.prebid.server.auction.TimeoutResolver;
import org.prebid.server.auction.aliases.BidderAliases;
import org.prebid.server.auction.model.AuctionContext;
import org.prebid.server.auction.model.Endpoint;
import org.prebid.server.auction.model.IpAddress;
Expand Down Expand Up @@ -126,7 +126,7 @@ public Ortb2ImplicitParametersResolver(boolean shouldCacheOnlyWinningBids,
this.generateBidRequestId = generateBidRequestId;
this.adServerCurrency = validateCurrency(Objects.requireNonNull(adServerCurrency));
this.blocklistedApps = Objects.requireNonNull(blocklistedApps);
this.serverInfo = ExtRequestPrebidServer.of(externalUrl, hostVendorId, datacenterRegion, null);
this.serverInfo = ExtRequestPrebidServer.of(externalUrl, hostVendorId, datacenterRegion, null, null);
this.bidderCatalog = Objects.requireNonNull(bidderCatalog);
this.paramsExtractor = Objects.requireNonNull(paramsExtractor);
this.timeoutResolver = Objects.requireNonNull(timeoutResolver);
Expand Down Expand Up @@ -192,6 +192,7 @@ public BidRequest resolve(BidRequest bidRequest,
ext,
bidRequest,
ObjectUtils.defaultIfNull(populatedImps, imps),
auctionContext.getHttpRequest().getHttpMethod().name(),
endpoint,
auctionContext.getAccount());

Expand Down Expand Up @@ -722,6 +723,7 @@ private static boolean isUniqueIds(List<Imp> imps) {
private ExtRequest populateRequestExt(ExtRequest ext,
BidRequest bidRequest,
List<Imp> imps,
String httpMethod,
String endpoint,
Account account) {

Expand All @@ -742,7 +744,7 @@ private ExtRequest populateRequestExt(ExtRequest ext,
ObjectUtil.getIfNotNull(prebid, ExtRequestPrebid::getCache)))
.channel(ObjectUtils.defaultIfNull(updatedChannel,
ObjectUtil.getIfNotNull(prebid, ExtRequestPrebid::getChannel)))
.server(serverInfo.with(endpoint))
.server(serverInfo.with(httpMethod, endpoint))
.build());

final Map<String, JsonNode> extProperties = ObjectUtil.getIfNotNull(ext, ExtRequest::getProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ public class ExtRequestPrebidServer {

String datacenter;

String httpMethod;

String endpoint;

public ExtRequestPrebidServer with(String endpoint) {
public ExtRequestPrebidServer with(String httpMethod, String endpoint) {
return ExtRequestPrebidServer.of(
this.externalUrl,
this.gvlId,
this.datacenter,
httpMethod,
endpoint);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.iab.openrtb.request.SupplyChain;
import com.iab.openrtb.request.User;
import com.iab.openrtb.request.Video;
import io.vertx.core.http.HttpMethod;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -138,6 +139,7 @@ public void setUp() {
defaultBidRequest = BidRequest.builder().build();

auctionContext = givenAuctionContext(HttpRequestContext.builder()
.httpMethod(HttpMethod.POST)
.headers(CaseInsensitiveMultiMap.empty())
.build());

Expand Down Expand Up @@ -299,6 +301,7 @@ public void shouldNotImplicitlyResolveIpIfIpv6IsPassed() {
public void shouldNotSetDeviceDntIfHeaderHasInvalidValue() {
// given
final HttpRequestContext httpRequest = HttpRequestContext.builder()
.httpMethod(HttpMethod.POST)
.headers(CaseInsensitiveMultiMap.builder()
.add("DNT", "invalid")
.build())
Expand All @@ -316,6 +319,7 @@ public void shouldNotSetDeviceDntIfHeaderHasInvalidValue() {
public void shouldSetDeviceDntIfHeaderExists() {
// given
final HttpRequestContext httpRequest = HttpRequestContext.builder()
.httpMethod(HttpMethod.POST)
.headers(CaseInsensitiveMultiMap.builder()
.add("DNT", "1")
.build())
Expand All @@ -333,6 +337,7 @@ public void shouldSetDeviceDntIfHeaderExists() {
public void shouldOverrideDeviceDntIfHeaderExists() {
// given
final HttpRequestContext httpRequest = HttpRequestContext.builder()
.httpMethod(HttpMethod.POST)
.headers(CaseInsensitiveMultiMap.builder()
.add("DNT", "0")
.build())
Expand Down Expand Up @@ -2547,7 +2552,12 @@ public void shouldPassExtPrebidServer() {
.extracting(BidRequest::getExt)
.extracting(ExtRequest::getPrebid)
.extracting(ExtRequestPrebid::getServer)
.isEqualTo(ExtRequestPrebidServer.of("https://external.url/", 0, "datacenter-region", ENDPOINT));
.isEqualTo(ExtRequestPrebidServer.of(
"https://external.url/",
0,
"datacenter-region",
HttpMethod.POST.name(),
ENDPOINT));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.iab.openrtb.response.Bid;
import com.iab.openrtb.response.BidResponse;
import com.iab.openrtb.response.SeatBid;
import io.vertx.core.http.HttpMethod;
import org.junit.jupiter.api.Test;
import org.prebid.server.VertxTest;
import org.prebid.server.bidder.appnexus.proto.AppnexusBidExt;
Expand Down Expand Up @@ -553,7 +554,12 @@ public void makeHttpRequestsShouldUpdateExtAppnexusIfAmpRequest() {
// given
final BidRequest bidRequest = givenBidRequest(
request -> request.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, null, null, openrtb2_amp.value()))
.server(ExtRequestPrebidServer.of(
null,
null,
null,
HttpMethod.GET.name(),
openrtb2_amp.value()))
.build())),
givenImp(givenExt(identity())));

Expand All @@ -578,7 +584,12 @@ public void makeHttpRequestsShouldUpdateExtAppnexusIfVideoRequest() {
// given
final BidRequest bidRequest = givenBidRequest(
request -> request.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, null, null, openrtb2_video.value()))
.server(ExtRequestPrebidServer.of(
null,
null,
null,
HttpMethod.POST.name(),
openrtb2_video.value()))
.build())),
givenImp(givenExt(identity())));

Expand Down Expand Up @@ -624,7 +635,12 @@ public void makeHttpRequestsShouldSplitImpsByPods() {
// given
final BidRequest bidRequest = givenBidRequest(
request -> request.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, null, null, openrtb2_video.value()))
.server(ExtRequestPrebidServer.of(
null,
null,
null,
HttpMethod.POST.name(),
openrtb2_video.value()))
.build())),
IntStream.range(0, 42)
.mapToObj(i -> givenImp(
Expand All @@ -650,7 +666,12 @@ public void makeHttpRequestsShouldGenerateProperAdPodIds() {
// given
final BidRequest bidRequest = givenBidRequest(
request -> request.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, null, null, openrtb2_video.value()))
.server(ExtRequestPrebidServer.of(
null,
null,
null,
HttpMethod.POST.name(),
openrtb2_video.value()))
.build())),
givenImp(imp -> imp.id("1_random"), givenExt(ext -> ext.generateAdPodId(true))),
givenImp(imp -> imp.id("1_random"), givenExt(ext -> ext.generateAdPodId(true))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.iab.openrtb.response.Bid;
import com.iab.openrtb.response.BidResponse;
import com.iab.openrtb.response.SeatBid;
import io.vertx.core.http.HttpMethod;
import org.junit.jupiter.api.Test;
import org.prebid.server.VertxTest;
import org.prebid.server.auction.model.Endpoint;
Expand Down Expand Up @@ -140,7 +141,7 @@ public void makeHttpRequestsShouldPreserveOriginalExtFields() {
public void makeHttpRequestsShouldSetExtWithAmpTrue() {
// given
final ExtRequestPrebidServer server = ExtRequestPrebidServer.of(
null, null, null, Endpoint.openrtb2_amp.value());
null, null, null, HttpMethod.POST.name(), Endpoint.openrtb2_amp.value());
final ExtRequestPrebid prebid = ExtRequestPrebid.builder()
.server(server)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ public void makeHttpRequestsShouldPreserveExtPrebidServer() {
"http://localhost:8080",
1,
"dc-test",
"POST",
"/openrtb2/auction");

final ExtRequest extRequest = ExtRequest.of(ExtRequestPrebid.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.iab.openrtb.response.BidResponse;
import com.iab.openrtb.response.SeatBid;
import io.vertx.core.MultiMap;
import io.vertx.core.http.HttpMethod;
import org.apache.commons.lang3.ObjectUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -941,14 +942,20 @@ private static BidRequest givenVideoBidRequest(UnaryOperator<Imp.ImpBuilder> imp
private static BidRequest givenVideoBidRequest(
UnaryOperator<BidRequest.BidRequestBuilder> bidRequestCustomizer,
UnaryOperator<Imp.ImpBuilder>... impCustomizers) {

return bidRequestCustomizer.apply(BidRequest.builder()
.site(Site.builder().build())
.app(App.builder().build())
.imp(Arrays.stream(impCustomizers)
.map(SmaatoBidderTest::givenVideoImp)
.toList()))
.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, null, null, Endpoint.openrtb2_video.value()))
.server(ExtRequestPrebidServer.of(
null,
null,
null,
HttpMethod.POST.name(),
Endpoint.openrtb2_video.value()))
.build()))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private static BidRequest givenBidRequest(UnaryOperator<BidRequest.BidRequestBui
Imp... imps) {
return bidRequestCustomizer.apply(BidRequest.builder()
.ext(ExtRequest.of(ExtRequestPrebid.builder()
.server(ExtRequestPrebidServer.of(null, 1, null, null))
.server(ExtRequestPrebidServer.of(null, 1, null, null, null))
.build())).imp(List.of(imps))).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "GET",
"endpoint": "/openrtb2/amp"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "GET",
"endpoint": "/openrtb2/amp"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"externalurl" : "http://localhost:8080",
"gvlid" : 1,
"datacenter" : "local",
"endpoint" : "/openrtb2/auction"
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"externalurl": "http://localhost:8080",
"gvlid": 1,
"datacenter": "local",
"http_method": "POST",
"endpoint": "/openrtb2/auction"
}
}
Expand Down
Loading
Loading