Skip to content

Commit 70bb61e

Browse files
committed
Add/update docs.
1 parent 1f6a075 commit 70bb61e

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/HttpsProxyAgent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as tls from 'tls';
55
/**
66
* Construct an agent for http(s) requests. Mostly for testing purposes.
77
*
8-
* @param proxy
8+
* @param proxy - the proxy to use
9+
* @param options - to set additional TLS options for https requests, e.g. rejectUnauthorized
910
*/
1011
export function agent(proxy: HttpsProxySocket, options?: tls.ConnectionOptions) {
1112
return agentBase(async (req, opts: any) => {

src/HttpsProxySocket.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ export interface ConnectionOptions {
1616
}
1717

1818
/**
19-
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to the
20-
* specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
21-
*
22-
* @api public
19+
* The HttpsProxySocket class allows creating Socket connections via an HTTPS proxy.
20+
* HTTP proxies are not supported.
21+
* For http(s) requests, use HttpsProxyAgent as a wrapper around this.
2322
*/
24-
2523
export class HttpsProxySocket {
2624
proxy: tls.ConnectionOptions;
2725
proxyConfig: HttpsProxyConfig;
2826

27+
/**
28+
*
29+
* @param opts - The connection options to the proxy. At least host and port are required.
30+
* Use {rejectUnauthorized: true} to ignore certificates for the proxy (not the endpoint).
31+
* @param proxyConfig - { auth: 'username:password' } for basic auth.
32+
* { headers: {key: 'value'} } for custom headers.
33+
*/
2934
constructor(opts: tls.ConnectionOptions | string, proxyConfig?: HttpsProxyConfig) {
3035
let sanitizedOptions;
3136
if (typeof opts == 'string') {
@@ -50,7 +55,7 @@ export class HttpsProxySocket {
5055
/**
5156
* Create a new Socket connection.
5257
*
53-
* @param opts - hostname and port
58+
* @param opts - host and port
5459
*/
5560
connect(opts: ConnectionOptions): Promise<tls.TLSSocket> {
5661
return new Promise<tls.TLSSocket>((resolve, reject) => {

0 commit comments

Comments
 (0)