Skip to content

Commit

Permalink
Ensure CMCD query argument is replaced (#20)
Browse files Browse the repository at this point in the history
The query argument added by the CMCD connector is preserved in subsequent manifest/segment requests by THEOplayer, apparently leading to multiple CMCD arguments being accumulated, which is a problem as the URL grows indefinitely.
Using URLSearchParams set method, rather than append, ensures that the first CMCD argument is updated (the rest are removed) or one is appended.

Co-authored-by: Mattias Buelens <[email protected]>
  • Loading branch information
zmousm and MattiasBuelens authored Apr 9, 2024
1 parent 4437786 commit 06f1168
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/slow-melons-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/cmcd-connector-web": patch
---

Fixed an issue where multiple CMCD query arguments were being added to the request URL.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class QueryArgumentTransmissionModeStrategy implements TransmissionModeSt
const url = new URL(request.url);
const parameters = transformToQueryParameters(payload);
if (parameters) {
url.searchParams.append('CMCD', parameters);
url.searchParams.set('CMCD', parameters);
request.redirect({
...request,
url: url.href
Expand Down

0 comments on commit 06f1168

Please sign in to comment.