@niledatabase/server 5.3.1-alpha.4 → 5.3.1

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