X Tutup
Skip to content

fix(service-worker): preserve redirect policy on reconstructed asset requests#67494

Open
Yenya030 wants to merge 1 commit intoangular:mainfrom
Yenya030:patch/v048-sw-request-policy-expansion
Open

fix(service-worker): preserve redirect policy on reconstructed asset requests#67494
Yenya030 wants to merge 1 commit intoangular:mainfrom
Yenya030:patch/v048-sw-request-policy-expansion

Conversation

@Yenya030
Copy link

@Yenya030 Yenya030 commented Mar 6, 2026

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

AssetGroup.newRequestWithMetadata() reconstructs requests while preserving headers only.

In redirect handling paths (AssetGroup.fetchFromNetwork()), this drops an explicit redirect policy from the original request. As a result, a request made with redirect: 'error' can be reconstructed without that policy and continue through redirect-following behavior in the SW asset fetch path.

Issue Number: N/A

What is the new behavior?

  • Preserve redirect when reconstructing requests in newRequestWithMetadata().
  • Update service-worker test mocks to preserve request redirect semantics.
  • Add a regression test that verifies redirected lazy asset requests are rejected when redirect: 'error' is specified.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Test plan (executed locally):

  • bazelisk test --nocache_test_results //packages/service-worker/worker/test:test --test_arg=--filter="redirect policy is error|handles redirected responses|passes headers through to the server|does not pass non-allowed metadata through to the server"
  • bazelisk test --nocache_test_results //packages/service-worker/worker/test:test
  • bazelisk test --nocache_test_results //packages/service-worker/test:test

No docs were updated because this is an internal service worker request-metadata bugfix with regression coverage in existing test suites.

@pullapprove pullapprove bot requested a review from kirjs March 6, 2026 16:56
@angular-robot angular-robot bot added the area: service-worker Issues related to the @angular/service-worker package label Mar 6, 2026
@google-cla
Copy link

google-cla bot commented Mar 6, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ngbot ngbot bot added this to the Backlog milestone Mar 6, 2026
@Yenya030 Yenya030 force-pushed the patch/v048-sw-request-policy-expansion branch from 41f5dfb to a0796ef Compare March 6, 2026 17:15
…requests

Preserve the redirect mode when rebuilding asset requests in newRequestWithMetadata(). This keeps explicit redirect:error semantics intact across service-worker redirect handling.

Update the worker test mocks to model redirect defaults correctly and add focused regression coverage for redirected lazy assets with redirect:error.
@Yenya030 Yenya030 force-pushed the patch/v048-sw-request-policy-expansion branch from a0796ef to 58bf5ec Compare March 6, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: service-worker Issues related to the @angular/service-worker package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

X Tutup