forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy-agent.test-d.ts
More file actions
43 lines (39 loc) · 1.07 KB
/
proxy-agent.test-d.ts
File metadata and controls
43 lines (39 loc) · 1.07 KB
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
import { expectAssignable } from 'tsd'
import { URL } from 'url'
import { ProxyAgent, setGlobalDispatcher, getGlobalDispatcher, Agent, Pool } from '../..'
expectAssignable<ProxyAgent>(new ProxyAgent(''))
expectAssignable<ProxyAgent>(new ProxyAgent({ uri: '' }))
expectAssignable<ProxyAgent>(
new ProxyAgent({
connections: 1,
uri: '',
auth: '',
token: '',
maxRedirections: 1,
factory: (_origin: URL, opts: Object) => new Agent(opts),
requestTls: {
ca: [''],
key: '',
cert: '',
servername: '',
timeout: 1
},
proxyTls: {
ca: [''],
key: '',
cert: '',
servername: '',
timeout: 1
},
clientFactory: (origin: URL, opts: object) => new Pool(origin, opts)
})
)
{
const proxyAgent = new ProxyAgent('')
expectAssignable<void>(setGlobalDispatcher(proxyAgent))
expectAssignable<ProxyAgent>(getGlobalDispatcher())
// close
expectAssignable<Promise<void>>(proxyAgent.close())
// dispatch
expectAssignable<boolean>(proxyAgent.dispatch({ origin: '', path: '', method: 'GET' }, {}))
}