Remove the registered pending task when an interceptor chain throws before
returning an Observable. Preserve the original error for the caller and keep
finalize responsible for completion, Observable errors, and cancellation.
Apply cleanup to both the outer HTTP handler and the legacy interceptor
adapter, since each registers its own task that can otherwise block stability.
Add tests for synchronous errors, Observable errors, completion, and
unsubscribe with both functional and legacy interceptors.
Closes#71953
`httpResource` is initialized via a top-level IIFE so that sub-constructors
(`arrayBuffer`, `blob`, `text`) can be attached to the function object.
Without a `/* @__PURE__ */` annotation, Closure Compiler and other bundlers
treat this top-level IIFE as potentially side-effectful, retaining `httpResource`
and its transitive dependencies even when unused.
Provide cache lookup through the existing private transfer-cache options so httpResource clients without transfer caching do not retain cache restoration and hashing.
Preserve the optional dependency lookups, their timing, and synchronous hydration behavior. Update the http bundle golden to show the removal of the cache-related symbols.
Previously, `generate_api_docs(...)` targets lived directly in each
`//packages/**/BUILD.bazel` file (and `render_api_to_html(...)` in
`//tools/manual_api_docs/{blocks,elements}/BUILD.bazel`). Because
`render_api_to_html` validates links against
`//adev/scripts/routes:defined-routes.json`, running wildcard package
builds or tests such as `bazel test //packages/forms/...` pulled in the
`//adev/...` route generation and API manifest dependency graph across
all packages.
Move all framework `generate_api_docs` and manual API `render_api_to_html`
targets into `//adev/src/content/api` alongside `aria`, `cdk`, and `cli`,
leaving only lightweight `files_for_docgen` filegroups in `//packages/...`
and JSON extraction targets in `//tools/manual_api_docs/...`. Remove the
`generate_api_docs` wrapper from `//tools:defaults.bzl` so neither
`//packages/...` nor `//tools/...` loads or depends on `//adev/...`, and
add `//adev/src/content/api:api_docs_test` so `bazel test //adev/...`
explicitly exercises API doc generation and link validation.
The parameter encoding was using a plain object literal lookup to determine how to encode specific characters. This makes it vulnerable to prototype pollution.
These changes mitigate the issue by storing the mapping in a native `Map` instead.
`HttpClient` split `reportProgress` into `reportUploadProgress` and
`reportDownloadProgress`, but `httpResource` still passed its
`reportProgress` option to the deprecated `reportProgress` of
`HttpRequest`.
The `progress` signal of `httpResource` only tracks download events, so
`reportProgress` there already means download progress. Forward it as
`reportDownloadProgress` instead of adding a new option.
httpResource registers an 'abort' listener on the resource's AbortSignal
to unsubscribe the underlying request when it's cancelled. The listener
was only removed from the subscription's own error/complete callbacks,
but calling sub.unsubscribe() directly - which is exactly what happens
when the listener itself fires - doesn't trigger those callbacks. So on
the one path where the signal actually aborts, the listener was never
removed.
Passing { once: true } lets the removal happen automatically once the
listener fires, covering that path without touching the existing
error/complete cleanup, which is still needed for the paths where the
request finishes without ever aborting.
This also happens to route around a real leak on affected engines: an
AbortSignal that's had any listener attached isn't garbage collected
until it fires. https://bugs.webkit.org/show_bug.cgi?id=298499
Replaces the remaining hand-rolled deferred promise implementations
with the native `Promise.withResolvers()` API and removes the now
unused helper and import.
Follow-up to #69739.
We keep getting PRs that target single usages of `hasOwnProperty` and we have ~100 of them. These changes aim to address the issue centrally by swapping out all the instances and adding a lint rule against introducing new ones.
Cancel the unread response body before reporting NG02825 when its declared Content-Length exceeds the configured buffer limit. Without cancellation, SSR can finish while the underlying connection remains open.
Add regression coverage for the declared-length rejection path.
Prevent AbortController.abort() from executing during Observable teardown when a FetchBackend HTTP request has already completed successfully or errored.
Previously, FetchBackend unconditionally called abort() upon stream termination. When requests completed normally, calling abort() after delivery caused Chromium-based browsers to mark the resolved request as net::ERR_ABORTED in DevTools due to a race condition, leading to missing response body payloads ("Failed to load response data"). By tracking whether the request has already settled—similar to XhrBackend checking for xhr.readyState !== xhr.DONE—we ensure abort() is only called for unsettled, in-flight requests upon unsubscription.
Fixes#70071
Previously, `parseCookieValue` did not strip enclosing double quotes (`DQUOTE`) from quoted cookie values as specified in RFC 6265 Section 4.1.1. In addition, malformed percent-encoding in cookie values caused an unhandled `URIError` when calling `decodeURIComponent`.
Extract the charset parameter from the Content-Type response header in FetchBackend and pass it to TextDecoder when decoding text and json responses. When no valid charset is provided or supported, gracefully fall back to default utf-8 decoding.
Fixes#70061
Represent withRequestsMadeViaParent() with an internal delegating backend so the interceptor handler can distinguish delegated clients from independent child configurations.
Include the XSRF interceptor in the root token factory so the automatically provided HttpClient retains the documented default protection without requiring provideHttpClient().
Normalize value-specific HttpHeaders deletions before filtering. The string overload previously used String#indexOf and removed shorter values contained within the requested deletion value, potentially widening outgoing request metadata.
Preserve delete-all behavior only when no value is supplied, and cover string, array, and empty-string deletion.
Prevent lazy HttpHeaders and HttpParams clones from reusing value arrays owned by a materialized source. Append and value-specific delete operations previously mutated those shared arrays, violating the immutable API contract and allowing request metadata to bleed into later requests.
Share value arrays until an update mutates a specific header or parameter, then copy only that array. Cover the affected append and delete paths with regression tests that materialize the source first.
`makeCacheKey` joined the request fields with `|` before hashing. The url
and the serialized body can contain `|` themselves, so a shifted field
boundary (url `/items/a` + body `b|c` vs url `/items/a|b` + body `c`)
produced the same joined string and the same key, letting two distinct
requests share a transfer cache slot.
Join with `\0` instead, which cannot occur in a valid url or in encoded
params, so the field boundaries cannot be forged by field content.
When `HttpClient` is called from within an `effect()` or other reactive
context, any signal reads performed inside HTTP interceptors were
inadvertently tracked by that context. This caused the effect to
re-execute whenever those signals changed, regardless of whether the
signal was semantically related to the HTTP call.
The fix wraps the interceptor chain invocation in `untracked()` so that
signal reads inside interceptors — both functional (`withInterceptors`)
and class-based (`withInterceptorsFromDi`) — are invisible to the
calling reactive context. This matches the precedent set by the resource
API, which also wraps its loader in `untracked()` for the same reason.
Fixes#58682