better-call 1.0.8 → 1.0.9

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
@@ -4875,6 +4875,18 @@ var createRouter = (endpoints, config) => {
4875
4875
  if (!route?.data) {
4876
4876
  return new Response(null, { status: 404, statusText: "Not Found" });
4877
4877
  }
4878
+ const query = {};
4879
+ url.searchParams.forEach((value, key) => {
4880
+ if (key in query) {
4881
+ if (Array.isArray(query[key])) {
4882
+ query[key].push(value);
4883
+ } else {
4884
+ query[key] = [query[key], value];
4885
+ }
4886
+ } else {
4887
+ query[key] = value;
4888
+ }
4889
+ });
4878
4890
  const handler = route.data;
4879
4891
  const context = {
4880
4892
  path,
@@ -4883,7 +4895,7 @@ var createRouter = (endpoints, config) => {
4883
4895
  params: route.params ? JSON.parse(JSON.stringify(route.params)) : {},
4884
4896
  request,
4885
4897
  body: await getBody(handler.options.cloneRequest ? request.clone() : request),
4886
- query: Object.fromEntries(url.searchParams),
4898
+ query,
4887
4899
  _flag: "router",
4888
4900
  asResponse: true,
4889
4901
  context: config?.routerContext