diff --git a/examples/server.ts b/examples/server.ts index 7ae69d3..a8265f8 100644 --- a/examples/server.ts +++ b/examples/server.ts @@ -135,7 +135,11 @@ export async function handleRequest(request: Request): Promise { }); const gif = dataUrlToBytes(dataUrl); - return new Response(request.method === "HEAD" ? null : gif, { + // Deno 2's Response type requires a Uint8Array backed by an ArrayBuffer. + // Copying preserves the GIF bytes while making the body valid in Deno 1 and 2. + const responseBody = request.method === "HEAD" ? null : new Uint8Array(gif); + + return new Response(responseBody, { status: 200, headers: { ...commonHeaders,