Commit 2c9547ab 2c9547ab025cc31b1cccdbc08485e1e9b677662d by Nicolas Perriault

fixes #565 - undefined response when unicode URL

1 parent 7a83beaf
......@@ -1151,7 +1151,7 @@ Casper.prototype.handleReceivedResource = function(resource) {
return;
}
this.resources.push(resource);
if (resource.url !== this.requestUrl) {
if (resource.url !== this.requestUrl && decodeURIComponent(resource.url) !== this.requestUrl) {
return;
}
this.currentHTTPStatus = null;
......
casper.test.begin "resources tests", 5, (test) ->
casper.start "tests/site/resources.html", ->
test.assertEquals @resources.length, 1, "only one resource found"
onTime = ->
test.assertEquals(
@resources.length
2
"two resources found"
)
test.assertResourceExists(
/dummy\.js/i
"phantom image found via test RegExp"
)
test.assertResourceExists(
(res) -> res.url.match "dummy.js"
"phantom image found via test Function"
)
test.assertResourceExists(
"dummy.js"
"phantom image found via test String"
)
onTimeout = -> test.fail "waitForResource timeout occured"
@waitForResource "dummy.js", onTime, onTimeout
casper.run(-> test.done())
/*global casper*/
/*jshint strict:false*/
casper.test.begin("Basic resources tests", 5, function(test) {
casper.start("tests/site/resources.html", function() {
test.assertEquals(this.resources.length, 1, "only one resource found");
});
casper.waitForResource("dummy.js", function() {
test.assertEquals(this.resources.length, 2, "two resources found");
test.assertResourceExists(/dummy\.js/i, "phantom image found via test RegExp");
test.assertResourceExists(function(res) {
return res.url.match("dummy.js");
}, "phantom image found via test Function");
test.assertResourceExists("dummy.js", "phantom image found via test String");
}, function onTimeout() {
test.fail("waitForResource timeout occured");
});
casper.run(function() {
test.done();
});
});