psf-bch-api 7.3.1 → 7.3.2

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.
Files changed (2) hide show
  1. package/bin/server.js +6 -6
  2. package/package.json +1 -1
package/bin/server.js CHANGED
@@ -76,13 +76,13 @@ class Server {
76
76
 
77
77
  // URL normalization middleware - collapse multiple slashes
78
78
  app.use((req, res, next) => {
79
- if (req.path && req.path.includes('//')) {
79
+ if (req.url && req.url.includes('//')) {
80
+ // Split URL into path and query string
81
+ const [path, queryString] = req.url.split('?')
80
82
  // Collapse multiple consecutive slashes into a single slash
81
- const normalizedPath = req.path.replace(/\/+/g, '/')
82
- // Reconstruct req.url with normalized path
83
- const queryString = req.url.includes('?') ? req.url.substring(req.url.indexOf('?')) : ''
84
- req.url = normalizedPath + queryString
85
- req.path = normalizedPath
83
+ const normalizedPath = path.replace(/\/+/g, '/')
84
+ // Reconstruct req.url with normalized path (req.path is read-only and will auto-update)
85
+ req.url = queryString ? `${normalizedPath}?${queryString}` : normalizedPath
86
86
  }
87
87
  next()
88
88
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psf-bch-api",
3
- "version": "7.3.1",
3
+ "version": "7.3.2",
4
4
  "main": "psf-bch-api.js",
5
5
  "type": "module",
6
6
  "scripts": {