@niledatabase/server 5.3.1-alpha.3 → 5.3.1-alpha.5

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.mjs CHANGED
@@ -581,7 +581,16 @@ async function request(url, _init, config) {
581
581
  try {
582
582
  updatedHeaders.set("content-type", "application/json");
583
583
  const bodyStream = _init.body ?? _init.request?.body ?? request2.body;
584
- const bodyText = await new Response(bodyStream).text();
584
+ let bodyText;
585
+ if (bodyStream === request2.body) {
586
+ try {
587
+ bodyText = await request2.clone().text();
588
+ } catch (e) {
589
+ bodyText = await new Response(bodyStream).text();
590
+ }
591
+ } else {
592
+ bodyText = await new Response(bodyStream).text();
593
+ }
585
594
  try {
586
595
  params.body = JSON.stringify(JSON.parse(bodyText));
587
596
  } catch {