@kapeta/local-cluster-service 0.33.4 → 0.33.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.33.5](https://github.com/kapetacom/local-cluster-service/compare/v0.33.4...v0.33.5) (2024-01-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Include query params in forwarded requests ([#113](https://github.com/kapetacom/local-cluster-service/issues/113)) ([6ccd067](https://github.com/kapetacom/local-cluster-service/commit/6ccd067de787de0c3d9ec21d0e8289778798d00e))
7
+
1
8
  ## [0.33.4](https://github.com/kapetacom/local-cluster-service/compare/v0.33.3...v0.33.4) (2024-01-04)
2
9
 
3
10
 
@@ -76,6 +76,9 @@ function proxyRestRequest(req, res, opts) {
76
76
  if (!providerPath.startsWith('/')) {
77
77
  providerPath = '/' + providerPath;
78
78
  }
79
+ if (!lodash_1.default.isEmpty(req.query)) {
80
+ providerPath += '?' + new URLSearchParams(req.query).toString();
81
+ }
79
82
  const requestHeaders = lodash_1.default.clone(req.headers);
80
83
  delete requestHeaders['content-length'];
81
84
  delete requestHeaders['content-encoding'];
@@ -25,6 +25,9 @@ function proxyHttpRequest(req, res, opts) {
25
25
  if (opts.consumerPath.startsWith(sourceBasePath)) {
26
26
  path = path.replace(sourceBasePath, targetBasePath);
27
27
  }
28
+ if (!lodash_1.default.isEmpty(req.query)) {
29
+ path += '?' + new URLSearchParams(req.query).toString();
30
+ }
28
31
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);
29
32
  const reqOpts = {
30
33
  method: req.method,
@@ -76,6 +76,9 @@ function proxyRestRequest(req, res, opts) {
76
76
  if (!providerPath.startsWith('/')) {
77
77
  providerPath = '/' + providerPath;
78
78
  }
79
+ if (!lodash_1.default.isEmpty(req.query)) {
80
+ providerPath += '?' + new URLSearchParams(req.query).toString();
81
+ }
79
82
  const requestHeaders = lodash_1.default.clone(req.headers);
80
83
  delete requestHeaders['content-length'];
81
84
  delete requestHeaders['content-encoding'];
@@ -25,6 +25,9 @@ function proxyHttpRequest(req, res, opts) {
25
25
  if (opts.consumerPath.startsWith(sourceBasePath)) {
26
26
  path = path.replace(sourceBasePath, targetBasePath);
27
27
  }
28
+ if (!lodash_1.default.isEmpty(req.query)) {
29
+ path += '?' + new URLSearchParams(req.query).toString();
30
+ }
28
31
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);
29
32
  const reqOpts = {
30
33
  method: req.method,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.33.4",
3
+ "version": "0.33.5",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -104,6 +104,10 @@ export function proxyRestRequest(req: StringBodyRequest, res: Response, opts: Pr
104
104
  providerPath = '/' + providerPath;
105
105
  }
106
106
 
107
+ if (!_.isEmpty(req.query)) {
108
+ providerPath += '?' + new URLSearchParams(req.query as any).toString();
109
+ }
110
+
107
111
  const requestHeaders = _.clone(req.headers);
108
112
 
109
113
  delete requestHeaders['content-length'];
@@ -27,6 +27,10 @@ export function proxyHttpRequest(req: StringBodyRequest, res: Response, opts: Pr
27
27
  path = path.replace(sourceBasePath, targetBasePath);
28
28
  }
29
29
 
30
+ if (!_.isEmpty(req.query)) {
31
+ path += '?' + new URLSearchParams(req.query as any).toString();
32
+ }
33
+
30
34
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);
31
35
 
32
36
  const reqOpts: SimpleRequest = {