Permalink
Browse files

Format status code as integer when building status line

Fixes '.0' appended to status code on Lua 5.3.
  • Loading branch information...
mpeterv committed Jul 5, 2016
1 parent e793ef0 commit 50708beb567ca8655666f0274fcd0148a9509070
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/wsapi/xavante.lua
View
@@ -63,9 +63,14 @@ local function wsapihandler (req, res, wsapi_run, app_prefix, docroot, app_path,
wsapi_env.APP_PATH = app_path
local function set_status(status)
if type(status) == "number" or status:match("^%d+$") then
status = status .. " " .. common.status_codes[tonumber(status)]
if type(status) == "string" and status:match("^%d+$") then
status = tonumber(status)
end
if type(status) == "number" then
status = ("%d %s"):format(status, common.status_codes[status])
end
res.statusline = "HTTP/1.1 " .. (status or "500 Internal Server Error")
end

0 comments on commit 50708be

Please sign in to comment.