From 0fd1d85273231b4e0f5794c452431230204ac84b Mon Sep 17 00:00:00 2001 From: Jesse Rogers Date: Mon, 25 Feb 2019 19:38:14 -0500 Subject: [PATCH] Add response.redirects: string[] property to superagent Responses --- types/superagent/index.d.ts | 2 ++ types/superagent/superagent-tests.ts | 1 + types/superagent/v2/index.d.ts | 1 + types/superagent/v2/superagent-tests.ts | 1 + 4 files changed, 5 insertions(+) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 7915277b37..de09e3ae7b 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -7,6 +7,7 @@ // Alec Zopf // Adam Haglund // Lukas Elmer +// Jesse Rogers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -116,6 +117,7 @@ declare namespace request { type: string; unauthorized: boolean; xhr: XMLHttpRequest; + redirects: string[]; } interface Request extends Promise { diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index b261a551d7..e7b032907a 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -202,6 +202,7 @@ request('/search') const contentLength = res.header['content-length']; const contentType: string = res.type; const charset: string = res.charset; + const redirects: string[] = res.redirects; }); // Getting response 'Set-Cookie' diff --git a/types/superagent/v2/index.d.ts b/types/superagent/v2/index.d.ts index 52ee4a149f..140ae0aefc 100644 --- a/types/superagent/v2/index.d.ts +++ b/types/superagent/v2/index.d.ts @@ -89,6 +89,7 @@ declare namespace request { forbidden: boolean; xhr: XMLHttpRequest; get(header: string): string; + redirects: string[]; } interface Request extends Promise /* extends NodeJS.WritableStream */ { diff --git a/types/superagent/v2/superagent-tests.ts b/types/superagent/v2/superagent-tests.ts index e0f0fcc592..a9ff954e4d 100644 --- a/types/superagent/v2/superagent-tests.ts +++ b/types/superagent/v2/superagent-tests.ts @@ -181,6 +181,7 @@ request('/search') const contentLength = res.header['content-length']; const contentType: string = res.type; const charset: string = res.charset; + const redirects: string[] = res.redirects; }); // Custom parsers