From 589ddae636a6f86be4f370a2a9f1a241a4eea72c Mon Sep 17 00:00:00 2001 From: Hendry Sadrak Date: Sun, 11 Oct 2020 14:03:30 +0300 Subject: [PATCH] Update request.ts Expose IgResponse in the Request class $end subject --- src/core/request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/request.ts b/src/core/request.ts index 66326dbec..eec0136e3 100644 --- a/src/core/request.ts +++ b/src/core/request.ts @@ -34,7 +34,7 @@ interface SignedPost { export class Request { private static requestDebug = debug('ig:request'); - end$ = new Subject(); + end$ = new Subject>(); error$ = new Subject(); attemptOptions: Partial> = { maxAttempts: 1, @@ -76,7 +76,7 @@ export class Request { Request.requestDebug(`Requesting ${options.method} ${options.url || options.uri || '[could not find url]'}`); const response = await this.faultTolerantRequest(options); this.updateState(response); - process.nextTick(() => this.end$.next()); + process.nextTick(() => this.end$.next(response)); if (response.body.status === 'ok' || (onlyCheckHttpStatus && response.statusCode === 200)) { return response; }