Title: HTTP transfer cache: QUERY/POST requests with different binary bodies share one cache key · Issue #72026 · angular/angular · GitHub
Open Graph Title: HTTP transfer cache: QUERY/POST requests with different binary bodies share one cache key · Issue #72026 · angular/angular
X Title: HTTP transfer cache: QUERY/POST requests with different binary bodies share one cache key · Issue #72026 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? common Is this a regression? No (the cache-key gap pre-dates it, but HttpClient.query() made QUERY requests cacheable by default, which exposes it) Description The HTTP transfer cach...
Open Graph Description: Which @angular/* package(s) are the source of the bug? common Is this a regression? No (the cache-key gap pre-dates it, but HttpClient.query() made QUERY requests cacheable by default, which expose...
X Description: Which @angular/* package(s) are the source of the bug? common Is this a regression? No (the cache-key gap pre-dates it, but HttpClient.query() made QUERY requests cacheable by default, which expose...
Opengraph URL: https://github.com/angular/angular/issues/72026
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTP transfer cache: QUERY/POST requests with different binary bodies share one cache key","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncommon\n\n### Is this a regression?\n\nNo (the cache-key gap pre-dates it, but `HttpClient.query()` made `QUERY` requests cacheable by default, which exposes it)\n\n### Description\n\nThe HTTP transfer cache builds its key in `makeCacheKey` (`packages/common/http/src/transfer_cache.ts`). Only string and `URLSearchParams` bodies are added to the key; every other body (`ArrayBuffer`, `Blob`, `FormData`) becomes an empty string.\n\n`QUERY` requests are cacheable by default (`ALLOWED_METHODS` includes `'QUERY'`), and `POST` is cacheable with `transferCache: true`. Two requests to the same URL with different binary bodies therefore share one key. On the server the second request is answered from the first one's cache entry without hitting the network, and `TransferState` ends up with a single entry holding the wrong response.\n\n### Minimal reproduction\n\nServer mode (`globalThis.ngServerMode = true`), `provideHttpClient()`, the transfer cache providers and `provideHttpClientTesting()`:\n\n```ts\nconst body = (s: string) => Uint8Array.from(s, (c) => c.charCodeAt(0)).buffer;\n\nhttp.query('/api/search', body('cats'), {responseType: 'text'}).subscribe(console.log);\nhttpTesting.expectOne('/api/search').flush('RESULT-FOR-CATS');\n\nhttp.query('/api/search', body('dogs'), {responseType: 'text'}).subscribe(console.log);\n// No second request reaches the backend; this logs 'RESULT-FOR-CATS'.\n```\n\nExpected: the second request is sent, and returns `RESULT-FOR-DOGS`.\n\n### Proposed fix\n\nA PR is ready: include `ArrayBuffer` and string-only `FormData` bodies in the key, and skip caching for bodies that cannot be read synchronously (`Blob`, `FormData` with files).\n\n### Angular version\n\n22.3.0-rc.0 and `main`\n","author":{"url":"https://github.com/mojerf","@type":"Person","name":"mojerf"},"datePublished":"2026-11-13T11:24:19Z","url":"https://github.com/angular/angular/issues/72026"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:138a6009-d659-6399-5624-fce1e6ec0439 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1B0:16AB79:3438362:426CCC3:6B01DEDC |
| html-safe-nonce | 7225deaecb43e32114f219af8adb95932a3f5598d36983d855fee0e3ead6597f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUIwOjE2QUI3OTozNDM4MzYyOjQyNkNDQzM6NkIwMURFREMiLCJ2aXNpdG9yX2lkIjoiMTkzNDY0MzIzODMxNzE4Njc4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b1112163d40deec26e276a8dbf356a4eb7ce7fabf2f74df04b87c17488df86bc |
| hovercard-subject-tag | issue:6370236023 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/72026/issue_layout |
| twitter:image | https://opengraph.githubassets.com/776a3f5bdd4bb246406f54c364940837cb2fd2603fb8823bb3d36cd6783254de/angular/angular/issues/72026 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/776a3f5bdd4bb246406f54c364940837cb2fd2603fb8823bb3d36cd6783254de/angular/angular/issues/72026 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? common Is this a regression? No (the cache-key gap pre-dates it, but HttpClient.query() made QUERY requests cacheable by default, which expose... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mojerf |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width