Add Regexp support, request repeating and include version number.

This commit is contained in:
Jared
2015-01-06 19:09:49 +13:00
parent 9ff4ff6377
commit 63db9fec7d
2 changed files with 25 additions and 2 deletions
+13 -1
View File
@@ -23,28 +23,35 @@ inst = inst.get(str, data);
inst = inst.patch(str);
inst = inst.patch(str, str);
inst = inst.patch(str, obj);
inst = inst.patch(str, regex);
inst = inst.post(str);
inst = inst.post(str, data);
inst = inst.post(str, obj);
inst = inst.post(str, regex);
inst = inst.put(str);
inst = inst.put(str, data);
inst = inst.put(str, obj);
inst = inst.put(str, regex);
inst = inst.delete(str);
inst = inst.delete(str, data);
inst = inst.delete(str, obj);
inst = inst.delete(str, regex);
inst = inst.merge(str);
inst = inst.merge(str, data);
inst = inst.merge(str, obj);
inst = inst.merge(str, regex);
inst = inst.intercept(str, str);
inst = inst.intercept(str, str, str);
inst = inst.intercept(str, str, obj);
inst = inst.intercept(str, str, regex);
inst = inst.intercept(str, str, str, value);
inst = inst.intercept(str, str, obj, str);
inst = inst.intercept(str, str, obj, value);
inst = inst.intercept(str, str, regex, value);
inst = inst.reply(num);
inst = inst.reply(num, str);
@@ -59,6 +66,11 @@ inst = inst.reply(num, (uri: string, body: string) => {
}, headers);
inst = inst.replyWithFile(num, str);
inst = inst.times(4);
inst = inst.once();
inst = inst.twice();
inst = inst.thrice();
inst = inst.defaultReplyHeaders(value);
inst = inst.matchHeader(str, str);
+12 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for nock
// Type definitions for nock v0.54.0
// Project: https://github.com/pgte/nock
// Definitions by: bonnici <https://github.com/bonnici>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -25,23 +25,29 @@ declare module "nock" {
post(path: string, data?: string): Scope;
post(path: string, data?: Object): Scope;
post(path: string, regex?: RegExp): Scope;
patch(path: string, data?: string): Scope;
patch(path: string, data?: Object): Scope;
patch(path: string, regex?: RegExp): Scope;
put(path: string, data?: string): Scope;
put(path: string, data?: Object): Scope;
put(path: string, regex?: RegExp): Scope;
head(path: string): Scope;
delete(path: string, data?: string): Scope;
delete(path: string, data?: Object): Scope;
delete(path: string, regex?: RegExp): Scope;
merge(path: string, data?: string): Scope;
merge(path: string, data?: Object): Scope;
merge(path: string, regex?: RegExp): Scope;
intercept(path: string, verb: string, body?: string, options?: any): Scope;
intercept(path: string, verb: string, body?: Object, options?: any): Scope;
intercept(path: string, verb: string, body?: RegExp, options?: any): Scope;
reply(responseCode: number, body?: string, headers?: Object): Scope;
reply(responseCode: number, body?: Object, headers?: Object): Scope;
@@ -62,6 +68,11 @@ declare module "nock" {
delay(timeMs: number): Scope;
delayConnection(timeMs: number): Scope;
times(repeats: number): Scope;
once(): Scope;
twice(): Scope;
thrice(): Scope;
done(): void;
isDone(): boolean;
restore(): void;