1 | /// <reference types="node" />
|
2 | /// <reference types="node" />
|
3 | import { ServerOptions as HttpsServerOptions } from 'https';
|
4 | import { ListenOptions } from 'net';
|
5 | export interface HttpOptions extends ListenOptions {
|
6 | protocol?: 'http';
|
7 | }
|
8 | export interface HttpsOptions extends ListenOptions, HttpsServerOptions {
|
9 | protocol: 'https';
|
10 | }
|
11 | /**
|
12 | * An object that requires host and port properties
|
13 | */
|
14 | export interface HostPort {
|
15 | host: string;
|
16 | port: number;
|
17 | }
|
18 | /**
|
19 | * Create an HTTP-server configuration that works well in test environments.
|
20 | * - Ask the operating system to assign a free (ephemeral) port.
|
21 | * - Use IPv4 localhost `127.0.0.1` to avoid known IPv6 issues in Docker-based
|
22 | * environments like Travis-CI.
|
23 | * - Provide default TLS key & cert when `protocol` is set to `https`.
|
24 | *
|
25 | * @param customConfig - Additional configuration options to apply.
|
26 | */
|
27 | export declare function givenHttpServerConfig<T extends HttpOptions | HttpsOptions>(customConfig?: T): HostPort & T;
|