godprotocol 2.2.93 → 2.2.94
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 +1 -1
- package/server/version_control.js +14 -2
package/package.json
CHANGED
|
@@ -160,8 +160,20 @@ const version_middleware = async (req, res, routers) => {
|
|
|
160
160
|
|
|
161
161
|
// remove query string from route
|
|
162
162
|
const parsedUrl = new URL(req.url, `http://${req.headers.host}`);
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
|
|
164
|
+
let routePath = parsedUrl.pathname;
|
|
165
|
+
|
|
166
|
+
// Remove /api/v1, /api/v2, /api/v3, etc.
|
|
167
|
+
routePath = routePath.replace(/^\/api\/v\d+(?=\/|$)/i, "");
|
|
168
|
+
|
|
169
|
+
// Ensure leading slash exists
|
|
170
|
+
if (!routePath.startsWith("/")) {
|
|
171
|
+
routePath = "/" + routePath;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
req.url = routePath;
|
|
175
|
+
|
|
176
|
+
const name = routePath.replace(/^\//, "");
|
|
165
177
|
|
|
166
178
|
const isWebhook = req.headers["is-webhook"];
|
|
167
179
|
|