Skip to content

[core-rest-pipeline] set init.duplex to "half" when streaming body via fetch #26890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2023

Conversation

jeremymeng
Copy link
Member

According to WHATWG fetch spec (https://fetch.spec.whatwg.org/#fetch-method) when body is a ReadableStream object, init.duplex must be set and currently the only valid value is "half". This PR sets the property when request body is a ReadableStream.

…a fetch

According to WHATWG fetch spec (https://fetch.spec.whatwg.org/#fetch-method)
when body is a ReadableStream object, init.duplex must be set and currently the
only valid value is "half"
@jeremymeng
Copy link
Member Author

/azp run js - storage-blob - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

// init.duplex must be set when body is a ReadableStream object.
// currently "half" is the only valid value.
if (streaming) {
(requestInit as any).duplex = "half";
Copy link
Member

Choose a reason for hiding this comment

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

Looks like adding that property to the type is being tracked in microsoft/TypeScript-DOM-lib-generator#1483

@jeremymeng jeremymeng merged commit 5ac7350 into Azure:main Aug 22, 2023
@jeremymeng jeremymeng deleted the core/fetch-duplex-half branch August 22, 2023 17:19
dgetu pushed a commit that referenced this pull request Sep 6, 2023
…a fetch (#26890)

According to WHATWG fetch spec
(https://fetch.spec.whatwg.org/#fetch-method) when body is a
ReadableStream object, init.duplex must be set and currently the only
valid value is "half". This PR sets the property when request body is a
ReadableStream.
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