Files
Tiago Linares 0d5b42c79e fix: preserve binary API response bytes in prod-server (#30)
Updated the production server to handle binary responses correctly by using Buffer.from with arrayBuffer instead of text(). Added a test to ensure binary data integrity and created a new fixture for testing binary API responses.
2026-02-25 04:36:28 +00:00

10 lines
445 B
TypeScript

import type { NextApiRequest, NextApiResponse } from "next";
export default function handler(_req: NextApiRequest, res: NextApiResponse) {
// Leading bytes are intentionally invalid UTF-8; if a text decode/encode
// path is introduced, this payload will be visibly corrupted.
const body = Buffer.from([0xff, 0xfe, 0xfd, 0x00, 0x61, 0x62, 0x63]);
res.setHeader("Content-Type", "application/octet-stream");
res.status(200).end(body);
}