backend-manager 4.0.27 → 4.0.29

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.27",
3
+ "version": "4.0.29",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -48,6 +48,7 @@ function BackendAssistant() {
48
48
  function tryUrl(self) {
49
49
  const req = self.ref.req;
50
50
  const Manager = self.Manager;
51
+ const assistant = self.assistant;
51
52
  const projectType = Manager?.options?.projectType;
52
53
 
53
54
  try {
@@ -55,13 +56,24 @@ function tryUrl(self) {
55
56
  const host = req.get('host');
56
57
  const forwardedHost = req.get('x-forwarded-host');
57
58
  const path = req.path;
59
+ const functionsUrl = Manager.project.functionsUrl;
58
60
 
59
61
  // Like this becuse "req.originalUrl" does NOT have path for all cases (like when calling https://us-central1-{id}.cloudfunctions.net/giftImport)
60
62
  if (projectType === 'firebase') {
61
- return forwardedHost
62
- ? `${protocol}://${forwardedHost}${path}`
63
- : `${protocol}://${host}${path}`;
63
+ if (assistant.isDevelopment()) {
64
+ return forwardedHost
65
+ ? `${protocol}://${forwardedHost}${path}`
66
+ : `${functionsUrl}/${self.meta.name}`;
67
+ } else {
68
+ return forwardedHost
69
+ ? `${protocol}://${forwardedHost}${path}`
70
+ : `${protocol}://${host}/${self.meta.name}`;
71
+ }
72
+ } else if (projectType === 'custom') {
73
+ return `@@@TODO`;
64
74
  }
75
+
76
+ return '';
65
77
  } catch {
66
78
  return '';
67
79
  }