Skip to content

HttpTransferCache collapses distinct binary POST bodies into the same cache key #70226

Open

Description

@SkyZeroZx

Which @angular/* package(s) are the source of the bug?

common / http

Is this a regression?

No

Description

With POST requests enabled in HttpTransferCache, two requests with different binary bodies can end up sharing one cache entry. This matters for valid POST-based APIs such as Protobuf and gRPC, where the request body carries the input. The same cache-key rule also applies to other POST APIs, including GraphQL requests.

I reproduced this with two read-only Protobuf requests to the same URL. The bodies are valid, but different:

document 100: 0864    document 200: 08c801

Angular should treat these as separate requests and cache their responses separately. Instead, the request for document 200 gets the cached response for document 100; it never reaches the origin.

else if (typeof serializedBody !== 'string') {
  serializedBody = '';
}

HttpRequest.serializeBody() returns a Blob as-is. Because a Blob is not a string, makeCacheKey() turns it into ''. That means both Protobuf payloads have the same cache-key input before hashing.

Please provide a link to a minimal reproduction of the bug

See Repository: https://github.com/SkyZeroZx/angular-protobuf-transfercache-poc

Activity

  1. added this to the needsTriage milestone on Aug 16, 2026
  2. added 6 commits that reference this issue on Aug 16, 2026
    b976779
    52eab8e
    d7f932d
    bc039fb
    8ee9f48
    4f4bc43
  3. added a commit that references this issue on Oct 20, 2026
    9d58d30
  4. added a commit that references this issue on Nov 11, 2026
    a7d4222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: common/httpIssues related to HTTP and HTTP Client

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions