Skip to content

Commit

Permalink
fix: one_signal: Encode external_id in endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Feb 27, 2024
1 parent 2ebff95 commit b1adfff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/v0/destinations/one_signal/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const trackResponseBuilder = (message, { Config }) => {
if (!externalUserId) {
throw new InstrumentationError('userId is required for track events/updating a device');
}
endpoint = `${endpoint}/${appId}/users/${externalUserId}`;
endpoint = `${endpoint}/${appId}/users/${encodeURIComponent(externalUserId)}`;
const payload = {};
const tags = {};
/* Populating event as true in tags.
Expand Down Expand Up @@ -163,7 +163,7 @@ const groupResponseBuilder = (message, { Config }) => {
if (!externalUserId) {
throw new InstrumentationError('userId is required for group events');
}
endpoint = `${endpoint}/${appId}/users/${externalUserId}`;
endpoint = `${endpoint}/${appId}/users/${encodeURIComponent(externalUserId)}`;
const payload = {};
const tags = {
groupId,
Expand Down
10 changes: 5 additions & 5 deletions test/integrations/destinations/one_signal/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -789,7 +789,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -870,7 +870,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -945,7 +945,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down
2 changes: 1 addition & 1 deletion test/integrations/destinations/one_signal/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
},
metadata: [{ jobId: 2, userId: 'u1' }],
batched: false,
Expand Down

0 comments on commit b1adfff

Please sign in to comment.