How to test HTMLRewriter locally?


HTMLRewriter is pretty cool and avoids to embedded such logic in our workers: Thanks to Clouflare worker team for this!

But using this new API broke our local test suite: We were relying on dollarshaveclub to locally test our workers but the support of HTMLRewriter is not planned - and will not be (see

Any way Cloudflare could provide it? Any recommandation to mock or emulate it? Anyone working on it in the community?

Seeing its exposition in the worker environment; I suppose it is based on native bindings which implementation cannot be shared with the community but still, Iā€™m asking the question :).

Thanks in advance for any advice!


Cloudflare recently implemented a development mode into Wrangler which might solve your use case. Be aware though that this feature is still pretty new and is not recommend for use in integration testing just yet


HTMLRewriter use under the hood. Read more here: , .

JS bindings are work in progress: .

Possibility to add support for HTMLRewrite in wrangler local dev functionality is discussed here: .

To wrap up - things do tend to look promising, but nothing seem to be guaranteed yet.

Hope that helps.