Skip to content

Commit

Permalink
(Request) notify user about request end properly
Browse files Browse the repository at this point in the history
  • Loading branch information
dilame committed Apr 11, 2019
1 parent 184d6da commit 96b04ea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ export class Request {
headers: this.getDefaultHeaders(userOptions.headers),
});
const response = await request(requestOptions);
process.nextTick(() => this.end$.next());
if (response.body.status === 'ok') {
return response;
}
const error = this.handleError(response);
this.end$.next();
throw error;
throw this.handleError(response);
}

public sign(payload: Payload): string {
Expand Down

0 comments on commit 96b04ea

Please sign in to comment.