mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
add handling for superagent pfx with passphrase
This commit is contained in:
3
types/superagent/index.d.ts
vendored
3
types/superagent/index.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
// 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;
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user