Fastify/4/Reply Raw Access

/icons/calendar.svg

Last update

Aug 26, 2024

This codemod converts reply.res moved to reply.raw.

🚦 Impact Level: Minimal

What Changed

If you previously used the reply.res attribute to access the underlying Request object you will now need to use reply.raw.

Before

fastify.get('/example', (request, reply) => {
const rawResponse = reply.res;
rawResponse.writeHead(200, { 'Content-Type': 'text/plain' });
rawResponse.end('Hello, World!');
});

After

fastify.get('/example', (request, reply) => {
const rawResponse = reply.raw;
rawResponse.writeHead(200, { 'Content-Type': 'text/plain' });
rawResponse.end('Hello, World!');
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now