Prerequisites
Fastify version
4.11.0
Plugin version
No response
Node.js version
19.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
linux mint
Description
I try to add custom parser to parse all image files.
I copy image content parser code from fastify documentation but fail to capture any image format.
This code throw error:
FastifyError: Unsupported Media Type: image/jpeg\n at ContentTypeParser.run.
fastify.addContentTypeParser(/^image\/.*/, { parseAs: "buffer" }, (req, payload, done) => {
done(null, payload)
});
But when i remove regrex and add hardcoded image format then no error thrown and image parsed successfully.
This code work:
fastify.addContentTypeParser("image/png", { parseAs: "buffer" }, (req, payload, done) => {
done(null, payload)
});
Steps to Reproduce
fastify.addContentTypeParser(/^image\/.*/, { parseAs: "buffer" }, (req, payload, done) => {
done(null, payload);
});
Expected Behavior
I want to capture all image mime type format.
Suggested regrex must work.
Prerequisites
Fastify version
4.11.0
Plugin version
No response
Node.js version
19.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
linux mint
Description
I try to add custom parser to parse all image files.
I copy image content parser code from fastify documentation but fail to capture any image format.
This code throw error:
FastifyError: Unsupported Media Type: image/jpeg\n at ContentTypeParser.run.But when i remove regrex and add hardcoded image format then no error thrown and image parsed successfully.
This code work:
Steps to Reproduce
Expected Behavior
I want to capture all image mime type format.
Suggested regrex must work.