Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk-common",
"version": "4.13.4",
"version": "4.13.5-alpha1",
"description": "Common library for Eppo JavaScript SDKs (web, react native, and node)",
"main": "dist/index.js",
"files": [
Expand Down
11 changes: 9 additions & 2 deletions src/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ export interface IBanditParametersResponse {
bandits: Record<string, BanditParameters>;
}

/**
* Fixes issues with url.toString() in older React Native versions
* that leaves a trailing slash in pathname
* @param url URL to stringify
* @returns stringified url
*/
const urlWithNoTrailingSlash = (url: URL) => {
url.pathname = url.pathname.replace(/\/$/, '');
return url.toString();
// Note: URL.pathname does not exist in some React Native JS runtime
// so we have to do string manipulation on the stringified URL
return url.toString().replace(/\/\?/, '?').replace(/\/$/, '');
};

export interface IHttpClient {
Expand Down
Loading