Msw
migration
byCodemod

Msw/2/Req Passthrough

/icons/badge-info.svg

Made for

Msw

/icons/calendar.svg

Last update

Apr 23, 2024

A new way of calling a passthrough is available in msw v2. This codemod replaces req.passthrough() calls with the new way of doing that using exported function.

Before

rest.get('/resource', (req, res, ctx) => {
return req.passthrough();
});

After

import { passthrough } from 'msw';
rest.get('/resource', (req, res, ctx) => {
return passthrough();
});

Build custom codemods

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

background illustrationGet Started Now