-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add duplex property to Request #1493
Conversation
Tests added. I'll create the implementation bugs when this is reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good. I was initially thinking we might want to de-duplicate some of the domintro with the duplex dictionary member, but for now this actually seems fine as they are somewhat different features even if they share a name. And we can revise when we add "full".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the motivation for this change.
I do have a concern with this implementation though, namely that this effectively sets the default value for duplex
to "half"
(even if the user did not specify a value). This is incompatible with Deno, because our default value has always been "full"
there (even though this is not explicitly exposed on a .duplex
member on the Request
object.
I think we'll just have to swallow the "implementation will vary from spec" pill here though, as we implemented full duplex streaming before standardization.
The user observable change here will be:
// Chrome
const req = new Request("Hello World");
req.duplex; // "half"
// Deno
const req = new Request("Hello World");
req.duplex; // "full"
This is not much worse than the status quo though, as the actual behaviour would be different between Deno and other browsers regardless of this PR. This PR just explicitly exposes this difference between the default duplex streaming behaviours in a string value that the user can see.
Also of note: this does not close the door to updating the default for duplex
being "full"
when a user specifies a ReadableStream
body.
LGTM
Yeah, I felt the same, but figured developers may go straight to either bit of documentation, so the duplication seem ok. |
@annevk Implementation bugs added. Could you take a look at web-platform-tests/wpt#36048 so (hopefully) browsers don't break the feature detect? |
Automatic update from web-platform-tests Fetch: Request duplex property For whatwg/fetch#1493. -- wpt-commits: 8fdd0c4c592ac976d264f30e87dc26b0150b4f70 wpt-pr: 36051
… detect, a=testonly Automatic update from web-platform-tests Request upload: test synchronous feature detect For whatwg/fetch#1493. -- wpt-commits: 9841e79d6f1301738125a2fbfbc6992c7b8ae366 wpt-pr: 36048
Automatic update from web-platform-tests Fetch: Request duplex property For whatwg/fetch#1493. -- wpt-commits: 8fdd0c4c592ac976d264f30e87dc26b0150b4f70 wpt-pr: 36051
… detect, a=testonly Automatic update from web-platform-tests Request upload: test synchronous feature detect For whatwg/fetch#1493. -- wpt-commits: 9841e79d6f1301738125a2fbfbc6992c7b8ae366 wpt-pr: 36048
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff