liudong
2023-05-29 340f156319b863525e50e900c58e59b86ecb3d5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import * as http from 'http'
import * as https from 'https'
import { expectType } from 'tsd'
import {
  HttpProxyAgent,
  HttpProxyAgentOptions,
  HttpsProxyAgent,
  HttpsProxyAgentOptions
} from '../'
 
{
  const agent = new HttpProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    proxy: 'http://localhost:8080'
  })
 
  expectType<HttpProxyAgent>(agent)
  http.request({
    method: 'GET',
    hostname: 'localhost',
    port: 9200,
    agent
  })
}
 
{
  const agent = new HttpsProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    proxy: 'http://localhost:8080'
  })
 
  expectType<HttpsProxyAgent>(agent)
  https.request({
    method: 'GET',
    hostname: 'localhost',
    port: 9200,
    agent
  })
}