summaryrefslogtreecommitdiffhomepage
path: root/libs/httpclient/luasrc/httpclient.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-03-02 19:45:07 +0000
committerSteven Barth <steven@midlink.org>2009-03-02 19:45:07 +0000
commiteb64affa398645bee4417d9117b439c2696269da (patch)
tree196c2fccc4784732973077a10d5b8f73cae2aab5 /libs/httpclient/luasrc/httpclient.lua
parent62a914555e2c037babb939553b8f819bb194c1e9 (diff)
Set method to POST if we have postdata and no other method is set
Diffstat (limited to 'libs/httpclient/luasrc/httpclient.lua')
-rw-r--r--libs/httpclient/luasrc/httpclient.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/httpclient/luasrc/httpclient.lua b/libs/httpclient/luasrc/httpclient.lua
index e1b4f83b7..01ef970d1 100644
--- a/libs/httpclient/luasrc/httpclient.lua
+++ b/libs/httpclient/luasrc/httpclient.lua
@@ -121,7 +121,6 @@ function request_raw(uri, options)
options.depth = options.depth or 10
local headers = options.headers or {}
local protocol = options.protocol or "HTTP/1.1"
- local method = options.method or "GET"
headers["User-Agent"] = headers["User-Agent"] or "LuCI httpclient 0.1"
if headers.Connection == nil then
@@ -158,10 +157,11 @@ function request_raw(uri, options)
headers["Content-Length"] = headers["Content-Length"] or #options.body
headers["Content-Type"] = headers["Content-Type"] or
"application/x-www-form-urlencoded"
+ options.method = options.method or "POST"
end
-- Assemble message
- local message = {method .. " " .. path .. " " .. protocol}
+ local message = {(options.method or "GET") .. " " .. path .. " " .. protocol}
for k, v in pairs(headers) do
if type(v) == "string" then