Skip to content

fix(http): correctly parse ArrayBuffer and Blob in transfer cache - #66835

Merged
AndrewKushnir merged 1 commit into
angular:mainfrom
SkyZeroZx:http-fix-array-buffer
Feb 9, 2026
Merged

AndrewKushnir merged 1 commit into
angular:mainfrom
SkyZeroZx:http-fix-array-buffer

Conversation

@SkyZeroZx

@SkyZeroZx SkyZeroZx commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

Encodes arraybuffer and blob response bodies as base64 when storing in the transfer cache, ensuring correct retrieval and usage on the client side

Fixes #66827

What is the current behavior?

Issue Number: #66827

I can also reproduce this issue using protobufjs in https://github.com/SkyZeroZx/issue-buffer-blob

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot Bot added the area: common/http Issues related to HTTP and HTTP Client label Jan 29, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jan 29, 2026
@SkyZeroZx
SkyZeroZx force-pushed the http-fix-array-buffer branch from 4602af2 to d20b5a6 Compare January 29, 2026 20:25
@SkyZeroZx SkyZeroZx changed the title fix(http): support transfer cache for ArrayBuffer and Blob responses fix(http): correctly parse ArrayBuffer and Blob in transfer cache Jan 29, 2026
@alan-agius4

Copy link
Copy Markdown
Contributor

@SkyZeroZx is this ready for review?

@SkyZeroZx
SkyZeroZx marked this pull request as ready for review January 30, 2026 14:07
@pullapprove
pullapprove Bot requested a review from atscott January 30, 2026 14:08
@SkyZeroZx

Copy link
Copy Markdown
Contributor Author

@SkyZeroZx is this ready for review?

I think so, updated

@JeanMeche
JeanMeche requested review from alan-agius4 and removed request for atscott January 31, 2026 11:03
@SkyZeroZx
SkyZeroZx force-pushed the http-fix-array-buffer branch from d20b5a6 to 96967b2 Compare January 31, 2026 19:28
Encodes arraybuffer and blob response bodies as base64 when storing in the transfer cache, ensuring correct retrieval and usage on the client side.

Fixes angular#66827
@SkyZeroZx
SkyZeroZx force-pushed the http-fix-array-buffer branch from 96967b2 to 469db27 Compare January 31, 2026 19:30

@JoostK JoostK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach is reasonable. It may be worth considering feature-detecting the availability of UInt8Array.{to,from}Base64()—or using Buffer.toString('base64') in Node < v25—to adopt platform-native encoding/decoding when available. In theory that should be more efficient as it avoids the intermediary "byte string", but I don't know if it makes an actual difference in practice.

@SkyZeroZx

Copy link
Copy Markdown
Contributor Author

I think this approach is reasonable. It may be worth considering feature-detecting the availability of UInt8Array.{to,from}Base64()—or using Buffer.toString('base64') in Node < v25—to adopt platform-native encoding/decoding when available. In theory that should be more efficient as it avoids the intermediary "byte string", but I don't know if it makes an actual difference in practice.

I think the same, we can do it in a follow-up PR since in my local tests I found a significant speed difference

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Feb 9, 2026
@AndrewKushnir
AndrewKushnir merged commit cb1163e into angular:main Feb 9, 2026
24 checks passed
@AndrewKushnir

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

httpResource.arrayBuffer causes [Object object] error with SSR

5 participants