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 | export declare type HostPort = {
|
11 | host: string;
|
12 | port: number;
|
13 | };
|
14 | /**
|
15 | * Create an HTTP-server configuration that works well in test environments.
|
16 | * - Ask the operating system to assign a free (ephemeral) port.
|
17 | * - Use IPv4 localhost `127.0.0.1` to avoid known IPv6 issues in Docker-based
|
18 | * environments like Travis-CI.
|
19 | * - Provide default TLS key & cert when `protocol` is set to `https`.
|
20 | *
|
21 | * @param customConfig - Additional configuration options to apply.
|
22 | */
|
23 | export declare function givenHttpServerConfig<T extends HttpOptions | HttpsOptions>(customConfig?: T): HostPort & T;
|