Permalink
Browse files

Unwatch only matched paths

  • Loading branch information...
1 parent f45eef0 commit 907122c0e30b760b95488bdc000d9a82a3c06ce5 @yohanboniface yohanboniface committed Dec 29, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 casperserver.js
View
@@ -86,18 +86,19 @@ Server.prototype._serve = function serve(request, response) {
// Handle response
var options = {};
for (var path in this.watchedPaths) {
+ this.log(path)
if (request.url.search(path) !== -1) {
options = this.watchedPaths[path];
this.log("Build response from watched path " + request.url);
+ if (!options.permanent) {
+ // Automatically unwatch path, not to pollute tests context
+ this.unwatchPath(path);
+ }
break;
}
}
options._request = request;
this._buildResponse(response, options);
- if (!options.permanent) {
- // Automatically unwatch path, not to pollute tests context
- this.unwatchPath(path);
- }
};

0 comments on commit 907122c

Please sign in to comment.