Re: [ServiceWorker] Can we change the body attribute of Request/Response to a method? (#606)

I think I understand now. I agree with @wanderview that "side effecting" is not quite the right framing. More, "will this cause any work" (and specifically, work that needs to be async---of which IPC is one case).

I think it would be a simpler mental model for developers if `req.body` was always "present" and accessible. That is, the mental model is "Requests have a body which is a stream, plus convenience methods like `.text()` for reading the stream."

Whereas if they have to call `req.body()` (or probably `req.stream()` would be a better name) the mental model becomes "Requests are opaque objects which don't necessarily have an associated body. You can call `.stream()` to reify the body as a stream, or `.text()` to reify the body as text, etc."

But I do not feel that strongly about this, so if implementers think that mental model 2 is a better fit and allows better optimizations, we should probably do that.


---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/606#issuecomment-70883445

Received on Wednesday, 21 January 2015 17:37:41 UTC