fix: bug in the content type parser of fastify

This commit is contained in:
mahyargdz
2025-04-22 15:41:56 +03:30
parent 5883890e7f
commit 8598ffe67b
4 changed files with 22 additions and 4 deletions
+11 -1
View File
@@ -10,7 +10,17 @@ import { PaginationInterceptor } from "./core/interceptors/pagination.intercepto
import { ResponseInterceptor } from "./core/interceptors/response.interceptor";
async function bootstrap() {
const logger = new Logger("APP");
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
const fastifyAdapter = new FastifyAdapter({
bodyLimit: 10 * 1024 * 1024,
});
// Add multipart content type parser
fastifyAdapter.getInstance().addContentTypeParser("multipart/form-data", (_request, _payload, done) => {
done(null);
});
const app = await NestFactory.create<NestFastifyApplication>(AppModule, fastifyAdapter);
app.useGlobalPipes(new ValidationPipe({ transform: true, whitelist: true }));
app.useGlobalInterceptors(new ResponseInterceptor(), new PaginationInterceptor(), new ClassSerializerInterceptor(app.get(Reflector)));