Skip to content

[core][ts-http-runtime] support Blob type in getRequestBody#37424

Merged
jeremymeng merged 4 commits intoAzure:mainfrom
jeremymeng:core/ts-http-runtime-getrequestbody-blob
Mar 2, 2026
Merged

[core][ts-http-runtime] support Blob type in getRequestBody#37424
jeremymeng merged 4 commits intoAzure:mainfrom
jeremymeng:core/ts-http-runtime-getrequestbody-blob

Conversation

@jeremymeng
Copy link
Copy Markdown
Member

This PR adds the case of Blob where we should return the body as-is.

@jeremymeng jeremymeng requested a review from a team as a code owner March 2, 2026 18:18
Copilot AI review requested due to automatic review settings March 2, 2026 18:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the ts-http-runtime request body preparation logic to treat Blob bodies as binary payloads (instead of JSON-stringifying them), and adds browser-focused unit coverage for getRequestBody.

Changes:

  • Update getRequestBody to return Blob bodies as-is.
  • Export getRequestBody to enable direct unit testing.
  • Add a new browser test suite validating getRequestBody behavior for FormData/Blob/Uint8Array/ReadableStream.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/core/ts-http-runtime/src/client/sendRequest.ts Adds Blob handling in getRequestBody (and exports it for testing).
sdk/core/ts-http-runtime/test/browser/sendRequest.spec.ts Adds browser unit tests for getRequestBody, including the Blob case.

Comment thread sdk/core/ts-http-runtime/src/client/sendRequest.ts
Comment thread sdk/core/ts-http-runtime/test/browser/sendRequest.spec.ts
Copy link
Copy Markdown
Member

@timovv timovv left a comment

Choose a reason for hiding this comment

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

LGTM. Do we need a changelog entry?

@jeremymeng
Copy link
Copy Markdown
Member Author

LGTM. Do we need a changelog entry?

yes! I pushed an update

@jeremymeng jeremymeng changed the title [core][ts-http-runtime] fix getRequestBody issue where Blob body is stringified as JSON [core][ts-http-runtime] support Blob type in getRequestBody Mar 2, 2026
@jeremymeng jeremymeng merged commit cacf964 into Azure:main Mar 2, 2026
14 checks passed
@jeremymeng jeremymeng deleted the core/ts-http-runtime-getrequestbody-blob branch March 2, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants