mirror of
https://github.com/zhigang1992/interfake.git
synced 2026-04-30 13:02:08 +08:00
Almost there. Need to store routes as standalone things with state rather than as simple objects, and return them from the createroute method.
This commit is contained in:
@@ -20,21 +20,20 @@ function FluentInterface(server, o) {
|
||||
};
|
||||
|
||||
function cr() {
|
||||
debug('##SETUP CALLED FOR', route, 'with parent', parent);
|
||||
if (!parent) {
|
||||
if (!parent && !top) {
|
||||
debug('Fluent setup called for', route.request.url);
|
||||
lookupHash = server.createRoute(route, lookupHash);
|
||||
} else {
|
||||
} else if (parent && top) {
|
||||
debug('Fluent setup called for', route.request.url, 'with parent', parent.request.url, 'and top', top.request.url);
|
||||
if (!parent.afterResponse) {
|
||||
parent.afterResponse = {
|
||||
endpoints: []
|
||||
};
|
||||
}
|
||||
parent.afterResponse.endpoints.push(route);
|
||||
if (top) {
|
||||
server.createRoute(top);
|
||||
} else {
|
||||
server.createRoute(parent);
|
||||
}
|
||||
server.createRoute(top);
|
||||
} else {
|
||||
throw new Error('You cannot specify a parent without a top, dummy!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user