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 CHANGED
@@ -4871,7 +4871,16 @@ var createRouter = (endpoints, config) => {
4871
4871
  }
4872
4872
  const processRequest = async (request) => {
4873
4873
  const url = new URL(request.url);
4874
- const path = config?.basePath ? url.pathname.split(config.basePath)[1] : url.pathname;
4874
+ const path = config?.basePath ? url.pathname.split(config.basePath).reduce((acc, curr, index) => {
4875
+ if (index !== 0) {
4876
+ if (index > 1) {
4877
+ acc.push(`${config.basePath}${curr}`);
4878
+ } else {
4879
+ acc.push(curr);
4880
+ }
4881
+ }
4882
+ return acc;
4883
+ }, []).join("") : url.pathname;
4875
4884
  if (!path?.length) {
4876
4885
  return new Response(null, { status: 404, statusText: "Not Found" });
4877
4886
  }