realm-js
realm-js copied to clipboard
Strip trailing slash off baseUrl
Goals
Making it easier to configure a custom baseUrl.
Expected Results
When constructing an app with a custom baseUrl
it shouldn't matter if it has a trailing slash or not:
const app = new App({ baseUrl: "http://localhost:9090" });
const app = new App({ baseUrl: "http://localhost:9090/" });
// this yeilds errors due to a double slash in urls
Actual Results
When a slash is accidentally added to the baseUrl
errors like this occur (when using Realm Web):
Access to fetch at 'http://localhost:9090//api/client/v2.0/app/pholiota-vrozman-mtjhb/location' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Version of Realm and Tooling
- Realm JS SDK Version: Realm Web 1.2.1
- Node or React Native: Node, React Native and Web.
- Client OS & Version: N/A
- Which debugger for React Native: None
can I work on this please?