Merge pull request #25846 from wellth-app/master

add handling for superagent pfx with passphrase
This commit is contained in:
Daniel Rosenwasser
2018-05-23 08:46:07 -07:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@@ -1,9 +1,10 @@
// Type definitions for SuperAgent 3.5
// Type definitions for SuperAgent 3.8
// Project: https://github.com/visionmedia/superagent
// Definitions by: Nico Zelaya <https://github.com/NicoZelaya>
// Michael Ledin <https://github.com/mxl>
// Pap Lőrinc <https://github.com/paplorinc>
// Shrey Jain <https://github.com/shreyjain1994>
// Alec Zopf <https://github.com/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;

View File

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