Update internal.lua (#2053)

header 传进来可能是空值
This commit is contained in:
zhuilang
2025-05-21 17:52:32 +08:00
committed by GitHub
parent 5eab3d7e22
commit 077d1fbd64

View File

@@ -186,7 +186,7 @@ function M.request(interface, method, host, url, recvheader, header, content)
if content then
local data
if header["transfer-encoding"] == "chunked" then
if header and header["transfer-encoding"] == "chunked" then
data = string.format("%s %s HTTP/1.1\r\n%s\r\n", method, url, header_content)
else
data = string.format("%s %s HTTP/1.1\r\n%sContent-length:%d\r\n\r\n", method, url, header_content, #content)