bxo 0.0.5-dev.75 → 0.0.5-dev.76

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +9 -12
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ".": "./src/index.ts",
6
6
  "./plugins": "./plugins/index.ts"
7
7
  },
8
- "version": "0.0.5-dev.75",
8
+ "version": "0.0.5-dev.76",
9
9
  "type": "module",
10
10
  "devDependencies": {
11
11
  "@types/bun": "latest"
package/src/index.ts CHANGED
@@ -484,8 +484,10 @@ export default class BXO {
484
484
  return new Response(JSON.stringify({ error: "Invalid response", issues: res.error?.issues ?? [] }), { status: 500, headers: { "Content-Type": "application/json" } });
485
485
  }
486
486
  }
487
- const headers = mergeHeaders({ "Content-Type": "application/json" }, ctx.set.headers);
488
- return new Response(JSON.stringify(data), { status, headers });
487
+ return new Response(JSON.stringify(data), {
488
+ status,
489
+ headers: { "Content-Type": "application/json" }
490
+ });
489
491
  },
490
492
  text: (data, status = 200) => {
491
493
  if (route.schema?.response?.[status]) {
@@ -495,8 +497,10 @@ export default class BXO {
495
497
  return new Response(JSON.stringify({ error: "Invalid response", issues: res.error?.issues ?? [] }), { status: 500, headers: { "Content-Type": "application/json" } });
496
498
  }
497
499
  }
498
- const headers = mergeHeaders({ "Content-Type": "text/plain" }, ctx.set.headers);
499
- return new Response(String(data), { status, headers });
500
+ return new Response(String(data), {
501
+ status,
502
+ headers: { "Content-Type": "text/plain" }
503
+ });
500
504
  },
501
505
  status: (status, data) => {
502
506
  // Response validation if declared
@@ -508,14 +512,7 @@ export default class BXO {
508
512
  }
509
513
  }
510
514
 
511
- const resp = toResponse(data, { status });
512
- // Merge ctx.set.headers into final response
513
- const merged = new Response(resp.body, {
514
- status: resp.status,
515
- statusText: resp.statusText,
516
- headers: mergeHeaders(resp.headers, ctx.set.headers)
517
- });
518
- return merged;
515
+ return toResponse(data, { status });
519
516
  }
520
517
  };
521
518