From 956b86d22c8421c0bfca866afd331bf53b861b25 Mon Sep 17 00:00:00 2001 From: Chris Price <6090660+crprice@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:30:38 -0800 Subject: [PATCH] Support endpoint paths in data collector goff-api.ts Match logic in https://github.com/open-feature/js-sdk-contrib/blob/main/libs/providers/go-feature-flag-web/src/lib/go-feature-flag-web-provider.ts#L95 Signed-off-by: Chris Price <6090660+crprice@users.noreply.github.com> --- .../go-feature-flag-web/src/lib/controller/goff-api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/providers/go-feature-flag-web/src/lib/controller/goff-api.ts b/libs/providers/go-feature-flag-web/src/lib/controller/goff-api.ts index 05a38dd7f..d1ce4f922 100644 --- a/libs/providers/go-feature-flag-web/src/lib/controller/goff-api.ts +++ b/libs/providers/go-feature-flag-web/src/lib/controller/goff-api.ts @@ -22,7 +22,10 @@ export class GoffApiController { const request: DataCollectorRequest = { events: events, meta: dataCollectorMetadata }; const endpointURL = new URL(this.endpoint); - endpointURL.pathname = 'v1/data/collector'; + const dataCollectorPath = 'v1/data/collector'; + endpointURL.pathname = endpointURL.pathname.endsWith('/') + ? endpointURL.pathname + dataCollectorPath + : endpointURL.pathname + '/' + dataCollectorPath; try { const headers: HeadersInit = {