roboto-js 1.1.12 → 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,9 +52,12 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
52
52
  };
53
53
 
54
54
  // DEVELOPMENT
55
- if (this.config.baseUrl.indexOf('rbt.dorfio') !== -1) {
56
- this.config.baseUrl = 'http://rbt.dorfio.com';
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');
57
59
  }
60
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
58
61
 
59
62
  // Check if a request object is provided
60
63
  if (proxyReq && proxyReq.headers) {
package/dist/esm/index.js CHANGED
@@ -20,9 +20,10 @@ export default class Roboto {
20
20
  };
21
21
 
22
22
  // DEVELOPMENT
23
- if (this.config.baseUrl.indexOf('rbt.dorfio') !== -1) {
24
- this.config.baseUrl = 'http://rbt.dorfio.com';
23
+ function stripHttpsForDomains(baseUrl, domains) {
24
+ return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
25
25
  }
26
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
26
27
 
27
28
  // Check if a request object is provided
28
29
  if (proxyReq && proxyReq.headers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.1.12",
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,9 +31,11 @@ export default class Roboto{
31
31
  };
32
32
 
33
33
  // DEVELOPMENT
34
- if(this.config.baseUrl.indexOf('rbt.dorfio')!==-1){
35
- this.config.baseUrl = 'http://rbt.dorfio.com';
34
+ function stripHttpsForDomains(baseUrl, domains) {
35
+ return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
36
36
  }
37
+ this.config.baseUrl = stripHttpsForDomains(this.config.baseUrl, ['localhost','rbt.dorfio.com']);
38
+
37
39
 
38
40
  // Check if a request object is provided
39
41
  if (proxyReq && proxyReq.headers) {