From a9c6690a2c2b064bf9595a14c188dd265b0e12bc Mon Sep 17 00:00:00 2001 From: mp Date: Tue, 28 Nov 2023 10:02:37 -0300 Subject: [PATCH] (xAPI) - ensure the correct lrs_endpoint is used --- src/out/xapi/xapi.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/out/xapi/xapi.js b/src/out/xapi/xapi.js index 8450ad6..f717a0d 100644 --- a/src/out/xapi/xapi.js +++ b/src/out/xapi/xapi.js @@ -62,7 +62,9 @@ export default class XAPI { headers, }; - const xAPIEndpoint = new URL("xAPI/statements", lrs_endpoint); + // Remove /xapi(/)(statements)(/) from the end of the lrs_endpoint to ensure the correct endpoint is used + const fixed_lrs_endpoint = lrs_endpoint.replace(/\/xapi\/?(statements)?\/?$/i, ''); + const xAPIEndpoint = new URL("xAPI/statements", fixed_lrs_endpoint); try { const response = await fetch(xAPIEndpoint, requestOptions);