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')