A user should be able to provide observers as part of a Request or RequestOptions object in order to receive progress updates and chunks of data for uploading and downloading of data.
Download observers will receive Responses, while upload observers will receive some form of Progress Event
To support different semantics of subscriptions between RxJS Observables and Dart Streams, an Observer implementation should be provided which will translate nicely to both platforms.
var myObserver = new Observer(res => this.progress = res.bytesLoaded / res.totalBytes);
http.request('https://foo', {
downloadObserver: myObserver,
uploadObserver: null
}).subscribe(res => this.finalResponse = res.json());
The Response Observable returned from Http should still emit a single Response value and complete when the connection closes.
In order to perform the request without requiring a subscription on the Response Observable this feature would also require providing a means of specifying that the request should be executed immediately. This should be an additional property of Request and RequestOptions, name TBD.
These observers can be tested with the MockBackend, using methods called mockUpload and mockDownload.
A user should be able to provide observers as part of a
RequestorRequestOptionsobject in order to receive progress updates and chunks of data for uploading and downloading of data.Download observers will receive
Responses, while upload observers will receive some form of Progress EventTo support different semantics of subscriptions between RxJS Observables and Dart Streams, an
Observerimplementation should be provided which will translate nicely to both platforms.The Response Observable returned from
Httpshould still emit a singleResponsevalue and complete when the connection closes.In order to perform the request without requiring a subscription on the
Response Observablethis feature would also require providing a means of specifying that the request should be executed immediately. This should be an additional property ofRequestandRequestOptions, name TBD.These observers can be tested with the
MockBackend, using methods calledmockUploadandmockDownload.