-
Notifications
You must be signed in to change notification settings - Fork 92
/
nock.d.ts
47 lines (37 loc) · 1.52 KB
/
nock.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
declare module "nock" {
export = nock;
function nock (host: string, options?: nock.Options): nock.Scope;
module nock {
function cleanAll(): void;
var recorder: Recorder;
class Scope {
get(path: string, data?: string): Scope;
post(path: string, data?: string): Scope;
put(path: string, data?: string): Scope;
head(path: string): Scope;
delete(path: string, data?: string): Scope;
intercept(path: string, verb: string, body?: string, options?: any);
reply(responseCode: number, body?: string, headers?: any): Scope;
reply(responseCode: number, callback: (uri: string, body: string) => string, headers?: any): Scope;
replyWithFile(responseCode: number, fileName: string): Scope;
defaultReplyHeaders(headers: any);
matchHeader(name: string, value: string);
filteringPath(regex: RegExp, replace: string): Scope;
filteringPath(fn: (path: string) => string): Scope;
filteringRequestBody(regex: RegExp, replace: string): Scope;
filteringRequestBody(fn: (path: string) => string): Scope;
persist(): Scope;
log(out: () => void ): Scope;
done(): void;
isDone(): bool;
restore(): void;
}
class Recorder {
rec(capture?: bool): void;
play(): string[];
}
interface Options {
allowUnmocked?: bool;
}
}
}