Skip to content

Commit 2699ab6

Browse files
authored
Merge pull request #105 from IABTechLab/syw-UID2-3697-remove-webhook-url-lower-casing
Do not lowercase webhook URL as the path can be case sensitive
2 parents 58541d9 + 9ddab34 commit 2699ab6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/java/com/uid2/optout/partner/EndpointConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public static EndpointConfig fromJsonObject(JsonObject obj) throws JsonProcessin
4545
public static EndpointConfig fromJsonString(String str) throws JsonProcessingException, InvalidPropertiesFormatException {
4646
EndpointConfig ret = EndpointConfig.mapper.readValue(str, EndpointConfig.class);
4747

48-
// normalize name and URL, query_params and additional_headers are spared)
49-
ret.url = ret.url.toLowerCase();
48+
// normalize name, query_params and additional_headers are spared)
49+
// UID2-3697 do not normalize/lower case ret.url as it doesn't just contain the top level domain/hostname
50+
// but also optional path which is case sensitive
5051
ret.name = ret.name.toLowerCase();
5152

5253
// validate query_params, param should be in the format of key=val

src/test/java/com/uid2/optout/partner/OptOutPartnerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public void tearDown(TestContext ctx) {
3838
public void internalSite_expectSuccess(TestContext ctx) throws JsonProcessingException, InvalidPropertiesFormatException {
3939
String partnerConfigStr = "{" +
4040
" \"name\": \"ttd\",\n" +
41-
" \"url\": \"http://localhost:18083/uid2optout\",\n" +
41+
//UID2-3697 intentionally added some upper cases to make sure the url is the same as what's provided by DSP originally
42+
" \"url\": \"http://localhost:18083/AdServer/uid2optout\",\n" +
4243
" \"method\": \"GET\",\n" +
4344
" \"query_params\": [\n" +
4445
" \"uid2=${ADVERTISING_ID}\",\n" +
@@ -93,7 +94,7 @@ private void testConfig_expectSuccess(TestContext ctx, String partnerConfigStr,
9394
if (createInternalTestServer) {
9495
Async async = ctx.async();
9596
HttpServer server = this.createTestServer(ctx, req -> {
96-
ctx.assertEquals("/uid2optout", req.path());
97+
ctx.assertEquals("/AdServer/uid2optout", req.path());
9798

9899
String uid2Expected = OptOutEntry.idHashB64FromLong(1234);
99100
String uid2 = req.getParam(OptOutPartnerTest.PARAM_UID2);

0 commit comments

Comments
 (0)