Skip to content

Commit 50708be

Browse files
committed
Format status code as integer when building status line
Fixes '.0' appended to status code on Lua 5.3.
1 parent e793ef0 commit 50708be

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/wsapi/xavante.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,14 @@ local function wsapihandler (req, res, wsapi_run, app_prefix, docroot, app_path,
6363
wsapi_env.APP_PATH = app_path
6464

6565
local function set_status(status)
66-
if type(status) == "number" or status:match("^%d+$") then
67-
status = status .. " " .. common.status_codes[tonumber(status)]
66+
if type(status) == "string" and status:match("^%d+$") then
67+
status = tonumber(status)
6868
end
69+
70+
if type(status) == "number" then
71+
status = ("%d %s"):format(status, common.status_codes[status])
72+
end
73+
6974
res.statusline = "HTTP/1.1 " .. (status or "500 Internal Server Error")
7075
end
7176

0 commit comments

Comments
 (0)