better-call 1.0.9 → 1.0.11

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/client.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
2
- import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-Bn_wF2y_.cjs';
2
+ import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BEp4ze3Q.cjs';
3
3
 
4
4
  type HasRequired<T extends {
5
5
  body?: any;
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
2
- import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-Bn_wF2y_.js';
2
+ import { j as Router, X as UnionToIntersection, b as Endpoint, U as HasRequiredKeys } from './router-BEp4ze3Q.js';
3
3
 
4
4
  type HasRequired<T extends {
5
5
  body?: any;
package/dist/index.cjs CHANGED
@@ -230,7 +230,12 @@ function toResponse(data, init) {
230
230
  body = data;
231
231
  headers.set("Content-Type", "application/octet-stream");
232
232
  } else if (isJSONSerializable(data)) {
233
- body = JSON.stringify(data);
233
+ body = JSON.stringify(data, (key, value) => {
234
+ if (typeof value === "bigint") {
235
+ return value.toString();
236
+ }
237
+ return value;
238
+ });
234
239
  headers.set("Content-Type", "application/json");
235
240
  }
236
241
  return new Response(body, {
@@ -4868,7 +4873,6 @@ var createRouter = (endpoints, config) => {
4868
4873
  const url = new URL(request.url);
4869
4874
  const path = config?.basePath ? url.pathname.split(config.basePath)[1] : url.pathname;
4870
4875
  if (!path?.length) {
4871
- config?.onError?.(new Error("NOT_FOUND"));
4872
4876
  return new Response(null, { status: 404, statusText: "Not Found" });
4873
4877
  }
4874
4878
  const route = (0, import_rou3.findRoute)(router, request.method, path);
@@ -4894,7 +4898,7 @@ var createRouter = (endpoints, config) => {
4894
4898
  headers: request.headers,
4895
4899
  params: route.params ? JSON.parse(JSON.stringify(route.params)) : {},
4896
4900
  request,
4897
- body: await getBody(handler.options.cloneRequest ? request.clone() : request),
4901
+ body: handler.options.disableBody ? void 0 : await getBody(handler.options.cloneRequest ? request.clone() : request),
4898
4902
  query,
4899
4903
  _flag: "router",
4900
4904
  asResponse: true,