@platformatic/composer 2.70.1 → 2.71.0

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/lib/proxy.js CHANGED
@@ -81,16 +81,16 @@ module.exports = fp(async function (app, opts) {
81
81
  const basePath = `/${prefix ?? ''}`.replaceAll(/\/+/g, '/').replace(/\/$/, '')
82
82
  const dispatcher = getGlobalDispatcher()
83
83
 
84
+ let preRewrite = null
85
+
84
86
  if (needsRootTrailingSlash) {
85
- app.addHook('preHandler', function rootTrailingSlashPreHandler (req, reply, done) {
86
- if (req.url !== basePath) {
87
- done()
88
- return
87
+ preRewrite = function preRewrite (url) {
88
+ if (url === basePath) {
89
+ url += '/'
89
90
  }
90
91
 
91
- const { url, options } = reply.fromParameters(req.url + '/', req.params, prefix)
92
- reply.from(url.replace(/\/+$/, '/'), options)
93
- })
92
+ return url
93
+ }
94
94
  }
95
95
 
96
96
  /*
@@ -149,6 +149,7 @@ module.exports = fp(async function (app, opts) {
149
149
  prefix,
150
150
  rewritePrefix,
151
151
  upstream: service.proxy?.upstream ?? origin,
152
+ preRewrite,
152
153
 
153
154
  websocket: true,
154
155
  wsUpstream: ws?.upstream ?? url ?? origin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/composer",
3
- "version": "2.70.1",
3
+ "version": "2.71.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -32,13 +32,13 @@
32
32
  "typescript": "^5.5.4",
33
33
  "why-is-node-running": "2",
34
34
  "ws": "^8.16.0",
35
- "@platformatic/config": "2.70.1",
36
- "@platformatic/client": "2.70.1",
37
- "@platformatic/db": "2.70.1"
35
+ "@platformatic/config": "2.71.0",
36
+ "@platformatic/client": "2.71.0",
37
+ "@platformatic/db": "2.71.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@fastify/error": "^4.0.0",
41
- "@fastify/http-proxy": "^11.2.0",
41
+ "@fastify/http-proxy": "^11.3.0",
42
42
  "@fastify/reply-from": "^12.0.0",
43
43
  "@fastify/static": "^8.0.0",
44
44
  "@fastify/swagger": "^9.0.0",
@@ -68,12 +68,12 @@
68
68
  "rfdc": "^1.3.1",
69
69
  "semgrator": "^0.3.0",
70
70
  "undici": "^7.0.0",
71
- "@platformatic/config": "2.70.1",
72
- "@platformatic/scalar-theme": "2.70.1",
73
- "@platformatic/service": "2.70.1",
74
- "@platformatic/telemetry": "2.70.1",
75
- "@platformatic/generators": "2.70.1",
76
- "@platformatic/utils": "^2.70.1"
71
+ "@platformatic/config": "2.71.0",
72
+ "@platformatic/scalar-theme": "2.71.0",
73
+ "@platformatic/generators": "2.71.0",
74
+ "@platformatic/service": "2.71.0",
75
+ "@platformatic/telemetry": "2.71.0",
76
+ "@platformatic/utils": "^2.71.0"
77
77
  },
78
78
  "scripts": {
79
79
  "test": "pnpm run lint && borp -T --timeout=1200000 -c 1 && tsd",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/composer/2.70.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/composer/2.71.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Composer",
5
5
  "type": "object",