-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.d.ts
More file actions
60 lines (46 loc) · 1015 Bytes
/
index.d.ts
File metadata and controls
60 lines (46 loc) · 1015 Bytes
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
export type Options = {
/**
@default 80
*/
port?: number;
/**
Use a custom path.
For example, `/health` for a health-check endpoint.
@default '/'
*/
path?: string;
/**
Use the `GET` HTTP-method instead of `HEAD` to check if the server is running.
@default false
*/
useGet?: boolean;
/**
HTTP status codes to consider as successful responses.
@default [200]
*/
statusCodes?: readonly number[];
/**
An AbortSignal to abort the operation.
@example
```
import waitForLocalhost from 'wait-for-localhost';
// Timeout after 5 seconds
await waitForLocalhost({
port: 8080,
signal: AbortSignal.timeout(5000)
});
```
*/
signal?: AbortSignal;
};
/**
Wait for localhost to be ready.
Supports both HTTP/1 and HTTP/2 servers with automatic fallback.
@example
```
import waitForLocalhost from 'wait-for-localhost';
await waitForLocalhost({port: 8080});
console.log('Server is ready');
```
*/
export default function waitForLocalhost(options?: Options): Promise<{ipVersion: 4 | 6}>;