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