add test for URL encoding

This commit is contained in:
jomo 2015-05-26 21:51:45 +02:00
parent fd6fd0f1bd
commit 5ef3c4f59c

View File

@ -291,6 +291,20 @@ describe("Crafatar", function() {
}); });
}); });
it("should return correct HTTP response for URL encoded URLs", function(done) {
var url = "http://localhost:3000/%61%76%61%74%61%72%73/%6a%6f%6d%6f"; // avatars/jomo
request.get(url, function(error, res, body) {
assert.ifError(error);
assert.strictEqual(res.statusCode, 200);
assert_headers(res);
assert(res.headers["etag"]);
assert.strictEqual(res.headers["content-type"], "image/png");
assert.strictEqual(res.headers["etag"], '"bb2ea7307d"');
assert(body);
done();
});
});
var server_tests = { var server_tests = {
"avatar with existing username": { "avatar with existing username": {
url: "http://localhost:3000/avatars/jeb_?size=16", url: "http://localhost:3000/avatars/jeb_?size=16",