Skip to content

Commit

Permalink
Merge pull request #150 from soapdog/master
Browse files Browse the repository at this point in the history
fix(sailor): returns the correct 404 status for custom pages.
  • Loading branch information
Etiene authored Jul 20, 2017
2 parents 2aa1026 + a3fe7a8 commit 9657d5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sailor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/dev-app/tests/functional/category.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9657d5a

Please sign in to comment.