-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.d.ts
55 lines (51 loc) · 1.55 KB
/
types.d.ts
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
/**
* Create a simple API server.
*
* For use in tests only.
* Default port is 3000.
*
* 1. GET `/mirror` will return any query variables as json.
* 2. POST `/post` will return the posted body as json.
* @param options - the options object
* @param [options.port = 3000] - the port number to listen to
* @param [options.useSsl = false] - use ssl (https)
* @returns the HTTP API server object
*/
declare function createApiServer(options: {
port?: number;
useSsl?: number;
}): any;
/**
* HTTP Options
* @property port - the port to use
* @property useBasicAuth - use basic authorization
* @property [username = admin] - the username for basic authorization
* @property [password = secret] - the password for basic authorization
*/
declare type HttpOptions = {
port: number;
useBasicAuth: boolean;
username?: boolean;
password?: boolean;
};
/**
* Create a HTTP forwarding proxy
*
* For use in tests only.
* Default port is 8080.
* @param httpOptions - the http proxy options
* @returns the proxy server instance
*/
declare function createHttpProxy(httpOptions: HttpOptions): Promise<mockttp.Mockttp>;
/**
* Create a HTTPS forwarding proxy
*
* For use in tests only.
* Default port is 8081.
*
* This will generate certs for SSL, and add it to the root CAs temporarily.
* This prevents any self-signed cert errors for tests when using the https proxy.
* @param httpOptions - the http proxy options
* @returns the proxy server instance
*/
declare function createHttpsProxy(httpOptions: HttpOptions): Promise<mockttp.Mockttp>;