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.
- package/package.json +1 -1
- package/src/index.ts +9 -12
package/package.json
CHANGED
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
|
-
|
|
488
|
-
|
|
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
|
-
|
|
499
|
-
|
|
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
|
-
|
|
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
|
|