add async mock capability.. fixes #26
This commit is contained in:
@ -101,10 +101,9 @@ function mockResponses (route, targets) {
|
||||
}
|
||||
|
||||
if (target) {
|
||||
// debug('target response: %s', target.response)
|
||||
if (t.isFunction(target.response)) {
|
||||
const pathMatches = ctx.path.match(pathRe).slice(1)
|
||||
target.response.apply(null, [ctx].concat(pathMatches))
|
||||
return target.response.apply(null, [ctx].concat(pathMatches))
|
||||
} else if (t.isPlainObject(target.response)) {
|
||||
Object.assign(ctx.response, target.response)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user