httpclient: default content-type for post data is
authorSteven Barth <steven@midlink.org>
Mon, 2 Mar 2009 19:41:32 +0000 (19:41 +0000)
committerSteven Barth <steven@midlink.org>
Mon, 2 Mar 2009 19:41:32 +0000 (19:41 +0000)
"application/x-www-form-urlencoded"

libs/httpclient/luasrc/httpclient.lua

index 767a02e..e1b4f83 100644 (file)
@@ -152,12 +152,12 @@ function request_raw(uri, options)
        
        if type(options.body) == "table" then
                options.body = http.urlencode_params(options.body)
-               headers["Content-Type"] = headers["Content-Type"] or 
-                       "application/x-www-form-urlencoded"
        end
 
        if type(options.body) == "string" then
                headers["Content-Length"] = headers["Content-Length"] or #options.body
+               headers["Content-Type"] = headers["Content-Type"] or
+                       "application/x-www-form-urlencoded"
        end
        
        -- Assemble message