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.js CHANGED
@@ -4837,6 +4837,18 @@ var createRouter = (endpoints, config) => {
4837
4837
  if (!route?.data) {
4838
4838
  return new Response(null, { status: 404, statusText: "Not Found" });
4839
4839
  }
4840
+ const query = {};
4841
+ url.searchParams.forEach((value, key) => {
4842
+ if (key in query) {
4843
+ if (Array.isArray(query[key])) {
4844
+ query[key].push(value);
4845
+ } else {
4846
+ query[key] = [query[key], value];
4847
+ }
4848
+ } else {
4849
+ query[key] = value;
4850
+ }
4851
+ });
4840
4852
  const handler = route.data;
4841
4853
  const context = {
4842
4854
  path,
@@ -4845,7 +4857,7 @@ var createRouter = (endpoints, config) => {
4845
4857
  params: route.params ? JSON.parse(JSON.stringify(route.params)) : {},
4846
4858
  request,
4847
4859
  body: await getBody(handler.options.cloneRequest ? request.clone() : request),
4848
- query: Object.fromEntries(url.searchParams),
4860
+ query,
4849
4861
  _flag: "router",
4850
4862
  asResponse: true,
4851
4863
  context: config?.routerContext