backend-manager 4.0.24 → 4.0.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "4.0.24",
3
+ "version": "4.0.26",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -45,6 +45,16 @@ function BackendAssistant() {
45
45
  return self;
46
46
  }
47
47
 
48
+ function tryUrl(req) {
49
+ try {
50
+ // return `${req.protocol}://${req.get('host')}${req.originalUrl}`
51
+ // Like this becuse "req.originalUrl" does NOT have path for all cases (like when calling https://us-central1-{id}.cloudfunctions.net/giftImport)
52
+ return `${req.protocol}://${req.get('host')}`
53
+ } catch {
54
+ return '';
55
+ }
56
+ }
57
+
48
58
  function tryParse(input) {
49
59
  var ret;
50
60
 
@@ -178,7 +188,7 @@ BackendAssistant.prototype.init = function (ref, options) {
178
188
  } else {
179
189
  self.request.type = 'form';
180
190
  }
181
- self.request.url = `${self.ref.req.protocol}://${self.ref.req.get('host')}${self.ref.req.originalUrl}`;
191
+ self.request.url = tryUrl(self.ref.req);
182
192
  self.request.path = self.ref.req.path || '';
183
193
  self.request.user = self.resolveAccount({authenticated: false});
184
194