roboto-js 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,10 +52,12 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
52
52
  };
53
53
 
54
54
  // DEVELOPMENT
55
- var baseUrl = new URL(this.config.baseUrl);
56
- if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
57
- this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
55
+ function stripHttpsForDomains(baseUrl, domains) {
56
+ return baseUrl.replace(new RegExp("^https://(".concat(domains.map(function (domain) {
57
+ return domain.replace(/\./g, '\\.');
58
+ }).join('|'), ")")), 'http://$1');
58
59
  }
60
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
59
61
 
60
62
  // Check if a request object is provided
61
63
  if (proxyReq && proxyReq.headers) {
package/dist/esm/index.js CHANGED
@@ -20,10 +20,10 @@ export default class Roboto {
20
20
  };
21
21
 
22
22
  // DEVELOPMENT
23
- const baseUrl = new URL(this.config.baseUrl);
24
- if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
25
- this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
23
+ function stripHttpsForDomains(baseUrl, domains) {
24
+ return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
26
25
  }
26
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
27
27
 
28
28
  // Check if a request object is provided
29
29
  if (proxyReq && proxyReq.headers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -31,10 +31,10 @@ export default class Roboto{
31
31
  };
32
32
 
33
33
  // DEVELOPMENT
34
- const baseUrl = new URL(this.config.baseUrl);
35
- if (baseUrl.hostname === 'rbt.dorfio.com' || baseUrl.hostname.startsWith('localhost')) {
36
- this.config.baseUrl = url.toString().replace(/^https:/, 'http:');
34
+ function stripHttpsForDomains(baseUrl, domains) {
35
+ return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
37
36
  }
37
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost','rbt.dorfio.com']);
38
38
 
39
39
 
40
40
  // Check if a request object is provided