Skip to content

Commit

Permalink
Add missing warning for invalid consent_type (#1676)
Browse files Browse the repository at this point in the history
  • Loading branch information
SerhiiNahornyi authored and marki1an committed Feb 1, 2022
1 parent b7a0db9 commit 2b243b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ private static void validateConsentParam(ConsentParam consentParam, ConsentType
return;
}

if (consentType == ConsentType.unknown) {
errors.add("Invalid consent_type param passed");
return;
}

if (consentType == ConsentType.tcfV1) {
errors.add("Consent type tcfV1 is no longer supported");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,23 @@ public void shouldReturnBidRequestWithoutRegsExtUsPrivacyWhenConsentStringIsVali
assertThat(result.getRegs()).isNull();
}

@Test
public void shouldAddErrorToAuctionContextWhenConsentTypeIsOfUnknownType() {
// given
routingContext.queryParams()
.add("consent_string", "1Y-N")
.add("consent_type", "4");

givenBidRequest();

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

// then
assertThat(result.getPrebidErrors())
.containsExactly("Invalid consent_type param passed");
}

@Test
public void shouldReturnBidRequestWithCreatedExtPrebidAmpData() {
// given
Expand Down

0 comments on commit 2b243b2

Please sign in to comment.