diff --git a/src/sailor.lua b/src/sailor.lua index 8e07f36..cbf5031 100755 --- a/src/sailor.lua +++ b/src/sailor.lua @@ -145,7 +145,7 @@ function sailor.route(page) if sailor.conf.default_error404 and sailor.conf.default_error404 ~= '' then page.controller_view_path = nil _, res = xpcall(function () page:render(sailor.conf.default_error404) end, error_handler) - return res or httpd.OK or page.r.status or 200 + return res or httpd.OK or page.r.status or 404 end page.r.status = 404 return res or page.r.status diff --git a/test/dev-app/tests/functional/category.lua b/test/dev-app/tests/functional/category.lua index 681266e..8e73c83 100644 --- a/test/dev-app/tests/functional/category.lua +++ b/test/dev-app/tests/functional/category.lua @@ -56,12 +56,12 @@ describe("Testing #CategoryController", function() it("should not get category if id not found", function() local res = test.request('category/view', {get = {id = 42}}) - assert.same(200,res.status) + assert.same(404,res.status) assert.truthy(res.body:match('Error')) end) it("should not get category without id", function() local res = test.request('category/view') - assert.same(200,res.status) + assert.same(404,res.status) assert.truthy(res.body:match('Error')) end)