fix(platform-fastify): fix streamable file processing

This commit is contained in:
Kamil Myśliwiec
2021-11-03 09:52:42 +01:00
parent 1d35d7b687
commit 365c40bd98

View File

@@ -280,7 +280,6 @@ export class FastifyAdapter<
fastifyReply.status(statusCode);
}
if (body instanceof StreamableFile) {
body = body.getStream();
const streamHeaders = body.getHeaders();
if (fastifyReply.getHeader('Content-Type') === undefined) {
fastifyReply.header('Content-Type', streamHeaders.type);
@@ -288,6 +287,7 @@ export class FastifyAdapter<
if (fastifyReply.getHeader('Content-Disposition') === undefined) {
fastifyReply.header('Content-Disposition', streamHeaders.disposition);
}
body = body.getStream();
}
return fastifyReply.send(body);
}