service-worker: configure response status codes to treat as failed/offline with freshness strategy
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
service-worker
Is this a regression?
No
Description
Expected behaviour: freshness strategy should return to user fetching requested data only if request was successful. If request is unsuccessful (has 500, 504 and other codes) it should return cached result instead of bad result. And bad result should not be cached at all.
But in reality:
freshness strategy return for user bad results.
Interestingly, freshness strategy works as expected if web-server absolutely died (network error: connection refused). I mean, all configured in dataGroup requests begin to return from cache and web-application works despite dead backend. It is different with particular bad request (as I described above).
Performance strategy works as expected (it returns cached results firstly)
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 11.2.19
Node: 14.8.2
OS: darwin x64
Angular: 11.2.14
Anything else?
Issue Analytics
- State:
- Created a year ago
- Reactions:36
- Comments:6 (4 by maintainers)
Top GitHub Comments
@gkalpak Seems like we have 20+ upvotes.
Could you move the request to your consideration list?
Interesting 😃 Would anyone be interested in working on a pull request by any chance? 😁