Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of validation in AmpRequestFactory #1642

Merged
merged 1 commit into from
Dec 17, 2021
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 @@ -183,8 +183,6 @@ private Future<BidRequest> parseBidRequest(HttpRequestContext httpRequest, Aucti
.ext(createExt(httpRequest, tagId, debug))
.build();

validateOriginalBidRequest(bidRequest, consentString, auctionContext);

return Future.succeededFuture(bidRequest);
}

Expand Down Expand Up @@ -315,30 +313,6 @@ private static Map<String, String> ampDataFromQueryString(HttpRequestContext htt
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1));
}

private static void validateOriginalBidRequest(
BidRequest bidRequest,
String requestConsentString,
AuctionContext auctionContext) {

final User user = bidRequest.getUser();
final ExtUser extUser = user != null ? user.getExt() : null;
final String gdprConsentString = extUser != null ? extUser.getConsent() : null;

final Regs regs = bidRequest.getRegs();
final ExtRegs extRegs = regs != null ? regs.getExt() : null;
final String usPrivacy = extRegs != null ? extRegs.getUsPrivacy() : null;

if (StringUtils.isAllBlank(gdprConsentString, usPrivacy)) {
final String message = String.format(
"Amp request parameter %s or %s have invalid format: %s",
CONSENT_PARAM,
GDPR_CONSENT_PARAM,
requestConsentString);
logger.debug(message);
auctionContext.getPrebidErrors().add(message);
}
}

/**
* Creates {@link BidRequest} and sets properties which were not set explicitly by the client, but can be
* updated by values derived from headers and other request attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1309,21 +1309,6 @@ public void shouldReturnBidRequestWithoutUserWhenGdprConsentQueryParamIsInvalid(
assertThat(result.getUser()).isNull();
}

@Test
public void shouldAddErrorToAuctionContextWhenGdprConsentQueryParamIsInvalid() {
// given
routingContext.queryParams().add("gdpr_consent", "consent-value");

givenBidRequest();

// when
final AuctionContext result = target.fromRequest(routingContext, 0L).result();

// then
assertThat(result.getPrebidErrors())
.contains("Amp request parameter consent_string or gdpr_consent have invalid format: consent-value");
}

@Test
public void shouldReturnBidRequestWithExtPrebidDataBiddersUpdatedByFpdResolver() throws JsonProcessingException {
// given
Expand Down