Changed .reply definition to allow objects as for body parameter

This commit is contained in:
Dan Spencer
2014-06-10 17:20:28 +01:00
parent 9ff1cf69b3
commit 86146879bd
2 changed files with 4 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ var str: string;
var bool: boolean;
var data: string;
var num: number;
var obj: {};
var value: any;
var regex: RegExp;
var options: nock.Options;
@@ -29,7 +30,9 @@ inst = inst.intercept(str, str, str, value);
inst = inst.reply(num);
inst = inst.reply(num, str);
inst = inst.reply(num, str, headers);
inst = inst.reply(num, obj, headers);
inst = inst.reply(num, (uri: string, body: string) => {
return str;
});

1
nock/nock.d.ts vendored
View File

@@ -23,6 +23,7 @@ declare module "nock" {
intercept(path: string, verb: string, body?: string, options?: any): Scope;
reply(responseCode: number, body?: string, headers?: Object): Scope;
reply(responseCode: number, body?: Object, headers?: Object): Scope;
reply(responseCode: number, callback: (uri: string, body: string) => string, headers?: Object): Scope;
replyWithFile(responseCode: number, fileName: string): Scope;