Skip to content

HttpClient response observable is not cleaned up on Safari when requests times out #26453

@alleyj

Description

@alleyj

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] 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

On Safari only if a request made via HttpClient times out, such as if the server is not connected to the network, the observable returned by HttpClient never emits an error. The core problem is that Safari sends a timeout event in this situation instead of an error event.

This was written up and fixed in AngularJS #15380.
This has been written up before for Angular #13592 but was closed as part of a feature that got dropped.

Expected behavior

Request timeouts should emit an error on the response observable.

Minimal reproduction of the problem with instructions


import { HttpClient } from '@angular/common/http';

  // IP Address of some machine that isn't connected to the network
  this.httpClient.get('x.x.x.x')
  .subscribe(() => {
    console.log('Request succeeded');
  }, () => {
    // This block never runs on Safari
    console.log('Request failed');
  })

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

So we can properly handle request errors.

Environment


Angular version: 6.0.0


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [x] Safari (desktop) version 12, 9
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: common/httpIssues related to HTTP and HTTP Clientbrowser: safarifreq2: mediumopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).state: confirmedstate: has PRtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions