Files
module-fastwebcore/target/fastweb/response.lua
2026-08-04 20:09:14 +08:00

118 lines
2.2 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
local M = {}
--[[
FUNCTION 发送响应头
PARAM
state_num 状态码
state_desc 状态描述
--]]
function M.send_header(state_num, state_desc)
return fw_response:send_header(state_num, state_desc)
end
--[[
FUNCTION 发送WebSocket数据
PARAM
data : 数据
opcode : 帧类型(可选默认文本12二进制 8关闭 9ping 10pong)
--]]
function M.send_ws(data, opcode)
return fw_response:send_ws(data, opcode or 1)
end
--[[
FUNCTION 响应结束
--]]
function M.response_done()
fw_response:response_done()
end
--[[
FUNCTION 是否已响应
--]]
function M.is_response_done()
return fw_response:is_response_done()
end
--[[
FUNCTION 发送字符串
PARAM
value : 内容
--]]
function M.send(value)
return fw_response:send(value)
end
--[[
FUNCTION 发送字符串
PARAM
value 内容
state_num 状态码
state_sec 状态描述
--]]
function M.sendex(value, state_num, state_esc)
return fw_response:sendex(value, state_num, state_esc)
end
--[[
FUNCTION 发送文件
PARAM
filepath 文件路径
downbaud 限速每秒字节(-1=不限速)
state_num 状态码
state_sec 状态描述
--]]
function M.send_file(filepath, downbaud, state_num, state_desc)
return fw_response:send_file(filepath, downbaud, state_num, state_desc)
end
--[[
FUNCTION 重定向请求
PARAM
filepath 文件路径
MovedPermanently 是否永久重定向
--]]
function M.redirect(filepath,MovedPermanently)
return fw_response:redirect(filepath,MovedPermanently)
end
--[[
FUNCTION 转发请求
PARAM
filepath 转发路径
--]]
function M.forward(filepath)
return fw_response:forward(filepath)
end
--[[
FUNCTION 设置响应头。
PARAM
name : 名称
value : 值
--]]
function M.header(name, value)
fw_response:header(name, value)
end
--[[
FUNCTION 置后端渲染。
PARAM
name : 名称
value : 值
--]]
function M.set(name, value)
fw_response:set(name, value)
end
--[[
FUNCTION 置后端渲染。
PARAM
table : 名称
--]]
function M.sets(tab)
fw_response:sets(tab)
end
return M