Skip to content
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

Define "to read a request" more specifically #441

Closed
yutakahirano opened this issue Dec 20, 2016 · 6 comments
Closed

Define "to read a request" more specifically #441

yutakahirano opened this issue Dec 20, 2016 · 6 comments
Assignees

Comments

@yutakahirano
Copy link
Member

https://fetch.spec.whatwg.org/#read-a-request

See web-platform-tests/wpt#4362 (comment) for the background.

@yutakahirano yutakahirano self-assigned this Dec 20, 2016
@yutakahirano
Copy link
Member Author

@annevk I would like to make a separate change from #425. Right now I'm not sure the capability of the network layer in the fetch spec. What kind of object does it consume / generate?

@annevk
Copy link
Member

annevk commented Dec 20, 2016

It's rather opaque. Bytes go in and bytes come out. But with Request and Response objects JavaScript developers now have some control over what happens there in a way. So we need to filter when reading from them (or when creating them, but it seems like that was not the way streams ended up being designed).

@annevk
Copy link
Member

annevk commented Dec 20, 2016

The high-level goal is that we only allow Uint8Array objects in streams associated with either Request or Response objects, right? That seems important to test for and implement, even if we haven't quite figured out how to require that in the specification.

@yutakahirano
Copy link
Member Author

My understanding is you can create a Request object from arbitrary ReadableStream, but you need to pass a ReadableStream each of whose chunks is a Uint8Array object if you want to make a fetch() call.

@yutakahirano
Copy link
Member Author

For receiving a response body, it is specified in https://fetch.spec.whatwg.org/#http-network-fetch.

Whenever one or more bytes are transmitted from response’s message body, ...

For transferring a response from a service worker, it's specified in https://w3c.github.io/ServiceWorker/#dom-fetchevent-respondwith.

If response’s body is non-null, run these substeps:

@annevk
Copy link
Member

annevk commented Dec 20, 2016

My understanding is you can create a Request object from arbitrary ReadableStream

So the only case for this is you also write the reader to consume the request yourself, right? Because any browser-supplied reader for a request, be it fetch() or req.json() or some such, will error.

annevk pushed a commit that referenced this issue Jan 5, 2017
Basic test: web-platform-tests/wpt#4362. More tests are expected to be written as part of the implementation effort.

Further work: #441.

Fixes #88.
@annevk annevk closed this as completed in 6beb38d Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants