Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1151

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:

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: