Skip to content

HTTP client errors shouldn't be sent to both the connection and the input stream #7014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nex3 opened this issue Nov 28, 2012 · 4 comments
Closed
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Milestone

Comments

@nex3
Copy link
Member

nex3 commented Nov 28, 2012

Currently, if an error happens in an HttpClientConnection, it's passed to the onError callbacks of both the connection itself and the InputStream of the HttpClientResponse, should such a thing exist. Here's a simple reproduction:

    void main() {
      var client = new HttpClient();
      var url = new Uri.fromString("http://pub.dartlang.org");
      var connection = client.openUrl("GET", url);
      connection.onError = (e) => print("connection error: $e");
      connection.onRequest = (request) {
        request.outputStream.onError = (e) => print("request stream error: $e");
        request.outputStream.close();
      };
      connection.onResponse = (response) {
        response.inputStream.onData = response.inputStream.read;
        response.inputStream.onError = (e) => print("response stream error: $e");
        response.inputStream.onClosed = () => print("response stream closed");

        print("response headers received");
        client.shutdown(force: true);
      };
    }

@nex3
Copy link
Member Author

nex3 commented Nov 28, 2012

My preferred behavior would be for the error to be passed (only) to HttpClientConnection up the call to onResponse, at which point it should be passed (only) to HttpClientResponse.inputStream.onError.

@madsager
Copy link
Contributor

Set owner to @sgjesse.

@sgjesse
Copy link
Contributor

sgjesse commented Dec 3, 2012

Fixed in https://code.google.com/p/dart/source/detail?r=15570.


Added Fixed label.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Area-Library, Library-IO labels.

@nex3 nex3 added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels May 14, 2014
@nex3 nex3 added this to the M2 milestone May 14, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

4 participants