← All recipes
Moderne licensed

Add withXhr() to provideHttpClient()

Recipe IDorg.openrewrite.angular.migration.add-with-xhrArtifact@openrewrite/recipes-angular

Adds withXhr() to provideHttpClient() calls that select neither a withFetch() nor a withXhr() backend. Angular 22 made FetchBackend the default HttpBackend; withXhr() keeps the previous XMLHttpRequest based backend, which is also the only one that reports upload progress.

Single recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.angular.migration.add-with-xhr

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-angular