From 96b04eaa76a6bdca57a70d71a32cb61154a1a62a Mon Sep 17 00:00:00 2001 From: bowzee Date: Thu, 11 Apr 2019 13:47:08 +0300 Subject: [PATCH] (Request) notify user about request end properly --- src/core/request.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/request.ts b/src/core/request.ts index c0b04d428..1c342f20d 100644 --- a/src/core/request.ts +++ b/src/core/request.ts @@ -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 {