Merge pull request #3633 from Nemo157/nock-match-header-regex

Nock match header regex
This commit is contained in:
Masahiro Wakame
2015-02-11 20:18:56 +09:00
2 changed files with 7 additions and 1 deletions

View File

@@ -72,7 +72,10 @@ inst = inst.twice();
inst = inst.thrice();
inst = inst.defaultReplyHeaders(value);
inst = inst.matchHeader(str, str);
inst = inst.matchHeader(str, regex);
inst = inst.matchHeader(str, (val: string) => true);
inst = inst.delay(num);
inst = inst.delayConnection(num);
@@ -105,4 +108,4 @@ nock.recorder.rec({
});
strings = nock.recorder.play();
objects = nock.recorder.play();
objects = nock.recorder.play();

3
nock/nock.d.ts vendored
View File

@@ -55,7 +55,10 @@ declare module "nock" {
replyWithFile(responseCode: number, fileName: string): Scope;
defaultReplyHeaders(headers: Object): Scope;
matchHeader(name: string, value: string): Scope;
matchHeader(name: string, regex: RegExp): Scope;
matchHeader(name: string, fn: (value: string) => boolean): Scope;
filteringPath(regex: RegExp, replace: string): Scope;
filteringPath(fn: (path: string) => string): Scope;