Skip to content

Commit

Permalink
feat(binding-http): complete subscription on error
Browse files Browse the repository at this point in the history
When an error occurs in subscribeResource, call the complete() function before quitting

Signed-off-by: Hassib Belhaj <[email protected]>
  • Loading branch information
hasbel committed Jun 23, 2019
1 parent 9c65da1 commit b9428c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/binding-http/src/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ export default class HttpClient implements ProtocolClient {
}
});
});
req.on("error", (err: any) => error(err));
req.on("error", (err: any) => {
if (error) error(err);
if (complete) complete();
});

req.flushHeaders();
req.end();
Expand Down

0 comments on commit b9428c9

Please sign in to comment.