astro/packages/integrations/node/test/fixtures/api-route/src/pages/binary.ts
Matthew Phillips 44694d8a90
Fixes binary data request bodies in the Node adapter (#4055)
* Fixes binary data request bodies in the Node adapter

* Fix type
2022-07-26 10:31:54 -04:00

11 lines
261 B
TypeScript

export async function post({ request }: { request: Request }) {
let body = await request.arrayBuffer();
let data = new Uint8Array(body);
let r = data.reverse();
return new Response(r, {
headers: {
'Content-Type': 'application/octet-stream'
}
});
}