From c7139f6cd62a3d316d9845cdeb98a870a2bafd76 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Wed, 16 May 2018 15:48:29 -0400 Subject: [PATCH 1/3] add handling for superagent pfx with passphrase --- types/superagent/index.d.ts | 3 ++- types/superagent/superagent-tests.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 6520b4eb66..8f457c804c 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -4,6 +4,7 @@ // Michael Ledin // Pap Lőrinc // Shrey Jain +// Alec Zopf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -131,7 +132,7 @@ declare namespace request { on(name: string, handler: (event: any) => void): this; parse(parser: Parser): this; part(): this; - pfx(cert: Buffer | string): this; + pfx(cert: Buffer | string | { pfx: Buffer, passphrase: string }): this; pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; query(val: object | string): this; redirects(n: number): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 351e78b156..66046759f1 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -373,6 +373,16 @@ request .pfx(pfx) .end(callback); +// pfx with passphrase, from: https://github.com/visionmedia/superagent/pull/1230/commits/96af65ffc6256df633f893095d1dc828694bbfbc +const passpfx = fs.readFileSync('passcert.pfx'); +request + .post('/secure') + .pfx({ + pfx: passpfx, + passphrase: 'test' + }) + .end(callback); + // ok, from: https://github.com/visionmedia/superagent/commit/34533bbc29833889090847c45a82b0ea81b2f06d request .get('/404') From 5289ad7cc4947ae43846a89ea5aaa14036fe5d25 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Thu, 17 May 2018 10:28:42 -0400 Subject: [PATCH 2/3] incrementing version number in header --- types/superagent/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 8f457c804c..dc161d0fea 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 3.5 +// Type definitions for SuperAgent 3.8.3 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin From 4ec5c6f66454bc2d344d18eb1296d1fc784b1100 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Thu, 17 May 2018 10:48:00 -0400 Subject: [PATCH 3/3] removing patch version --- types/superagent/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index dc161d0fea..7daf5f47dc 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 3.8.3 +// Type definitions for SuperAgent 3.8 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin