diff --git a/lib/response.js b/lib/response.js index 429a2e4..648495a 100644 --- a/lib/response.js +++ b/lib/response.js @@ -77,7 +77,10 @@ module.exports = function(request, response, result) { return; } - if (result.status === -2) { + if (result.status === -3) { + response.writeHead(404, headers); + response.end(result.body); + } else if (result.status === -2) { response.writeHead(422, headers); response.end(result.body); } else if (result.status === -1) { diff --git a/lib/routes/avatars.js b/lib/routes/avatars.js index 863716e..6a2682e 100644 --- a/lib/routes/avatars.js +++ b/lib/routes/avatars.js @@ -52,7 +52,7 @@ module.exports = function(req, callback) { // check for extra paths if (req.url.path_list.length > 2) { callback({ - status: -2, + status: -3, body: "Invalid URL Path" }); return; diff --git a/lib/routes/capes.js b/lib/routes/capes.js index 28dd6fb..ddda379 100644 --- a/lib/routes/capes.js +++ b/lib/routes/capes.js @@ -11,7 +11,7 @@ module.exports = function(req, callback) { // check for extra paths if (req.url.path_list.length > 2) { callback({ - status: -2, + status: -3, body: "Invalid URL Path" }); return; diff --git a/lib/routes/renders.js b/lib/routes/renders.js index 900a71e..e1508e7 100644 --- a/lib/routes/renders.js +++ b/lib/routes/renders.js @@ -62,7 +62,7 @@ module.exports = function(req, callback) { // check for extra paths if (req.url.path_list.length > 3) { callback({ - status: -2, + status: -3, body: "Invalid URL Path" }); return; diff --git a/lib/routes/skins.js b/lib/routes/skins.js index 301e69b..f0b8e99 100644 --- a/lib/routes/skins.js +++ b/lib/routes/skins.js @@ -59,7 +59,7 @@ module.exports = function(req, callback) { // check for extra paths if (req.url.path_list.length > 2) { callback({ - status: -2, + status: -3, body: "Invalid URL Path" }); return; diff --git a/test/test.js b/test/test.js index 8d94f58..c45689c 100644 --- a/test/test.js +++ b/test/test.js @@ -859,10 +859,10 @@ describe("Crafatar", function() { }); }); - it("should return a 422 (invalid request path " + location + ")", function(done) { - request.get("http://localhost:3000/" + location + "/thisisaninvaliduuid/invalid", function(error, res, body) { + it("should return a 404 (invalid request path " + location + ")", function(done) { + request.get("http://localhost:3000/" + location + "/853c80ef3c3749fdaa49938b674adae6/invalid", function(error, res, body) { assert.ifError(error); - assert.strictEqual(res.statusCode, 422); + assert.strictEqual(res.statusCode, 404); done(); }); });