better-call 1.0.11 → 1.0.12
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/dist/index.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4833,7 +4833,16 @@ var createRouter = (endpoints, config) => {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
const processRequest = async (request) => {
|
|
4835
4835
|
const url = new URL(request.url);
|
|
4836
|
-
const path = config?.basePath ? url.pathname.split(config.basePath)
|
|
4836
|
+
const path = config?.basePath ? url.pathname.split(config.basePath).reduce((acc, curr, index) => {
|
|
4837
|
+
if (index !== 0) {
|
|
4838
|
+
if (index > 1) {
|
|
4839
|
+
acc.push(`${config.basePath}${curr}`);
|
|
4840
|
+
} else {
|
|
4841
|
+
acc.push(curr);
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
return acc;
|
|
4845
|
+
}, []).join("") : url.pathname;
|
|
4837
4846
|
if (!path?.length) {
|
|
4838
4847
|
return new Response(null, { status: 404, statusText: "Not Found" });
|
|
4839
4848
|
}
|