Skip to content

Document service workers don't support upload progress for httpClient reportProgress #24683

Closed
@epelc

Description

@epelc

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

I believe service workers do not support reporting upload progress(download progress should work) since it basically acts as a proxy and converts all XMLHttpRequests to the fetch api. This should be documented to avoid confusion. I just spent several hours trying to figure out why upload progress doesn't work when you use service workers.

Some more info on why:

  • Service workers act as a proxy for all requests

  • Requests come in as XmlHttpRequest or fetch and are always sent out to your server as a fetch request.

  • This can't be changed since service workers only support using the newer fetch api

  • Fetch doesn't support upload progress(it's not in the spec yet)

“it [fetch] is currently lacking when it comes to request progression (not response progression).” https://fetch.spec.whatwg.org/#fetch-api

image
the first uses xhr(XMLHttpRequest) but goes out of the service worker as a fetch request which is why you can’t get upload progress info

Expected behavior

Basically the docs should state that reportProgress doesn't work when using a service worker due to fetch api limitations.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Documenting this would make using service workers less confusing. Without these docs you have to dig deep and understand/know about more internals for XmlHttpRequest, fetch, how service workers actually work, etc.

Environment


Angular version: X.Y.Z


Browser:
- [x] Chrome (desktop) Version 67.0.3396.87 (Official Build) (64-bit)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions