From d36e32a1bf0ee5e163ee7ec19f0e5ad63815bf3d Mon Sep 17 00:00:00 2001 From: Beng Eu Date: Tue, 13 Jul 2021 15:02:12 +0800 Subject: [PATCH] fix: #43 use custom content type parser for application/json and text/plain Pipe the request stream for these content types instead of the default handling. See https://www.fastify.io/docs/latest/ContentTypeParser/. --- src/routes/object/createObject.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/routes/object/createObject.ts b/src/routes/object/createObject.ts index c9dc3e1d..15a628c2 100644 --- a/src/routes/object/createObject.ts +++ b/src/routes/object/createObject.ts @@ -49,6 +49,13 @@ export default async function routes(fastify: FastifyInstance) { tags: ['object'], }) + fastify.addContentTypeParser( + ['application/json', 'text/plain'], + function (request, payload, done) { + done(null) + } + ) + fastify.post( '/:bucketName/*', {