diff --git a/src/runtime/entries/cloudflare-pages.ts b/src/runtime/entries/cloudflare-pages.ts index 14c00bc42c..a46219ca07 100644 --- a/src/runtime/entries/cloudflare-pages.ts +++ b/src/runtime/entries/cloudflare-pages.ts @@ -1,5 +1,5 @@ import '#internal/nitro/virtual/polyfill' -import { requestHasBody, useRequestBody } from '../utils' +import { requestHasBody } from '../utils' import { nitroApp } from '../app' /** @see https://developers.cloudflare.com/pages/platform/functions/#writing-your-first-function */ @@ -32,7 +32,7 @@ export async function onRequest (ctx: CFRequestContext) { const url = new URL(ctx.request.url) let body if (requestHasBody(ctx.request)) { - body = await useRequestBody(ctx.request) + body = Buffer.from(await ctx.request.arrayBuffer()) } const r = await nitroApp.localCall({ diff --git a/src/runtime/entries/cloudflare.ts b/src/runtime/entries/cloudflare.ts index 202dcdff86..42c53b9965 100644 --- a/src/runtime/entries/cloudflare.ts +++ b/src/runtime/entries/cloudflare.ts @@ -1,7 +1,7 @@ import '#internal/nitro/virtual/polyfill' import { getAssetFromKV, mapRequestToAsset } from '@cloudflare/kv-asset-handler' import { withoutBase } from 'ufo' -import { requestHasBody, useRequestBody } from '../utils' +import { requestHasBody } from '../utils' import { nitroApp } from '../app' import { useRuntimeConfig } from '#internal/nitro' @@ -19,7 +19,7 @@ async function handleEvent (event: FetchEvent) { const url = new URL(event.request.url) let body if (requestHasBody(event.request)) { - body = await useRequestBody(event.request) + body = Buffer.from(await event.request.arrayBuffer()) } const r = await nitroApp.localCall({