@@ -71,31 +71,31 @@ local function prepare(url_parts, session, config)
7171
7272 if json then
7373 content = cjson .encode (json )
74- headers [" Content-Length " ] = # content
75- headers [" Content-Type " ] = " application/json"
74+ headers [" content-length " ] = # content
75+ headers [" content-type " ] = " application/json"
7676 else
7777 content = body
7878 if is_func (body ) then
7979 -- users may know their request body size
80- if not headers [" Content-Length " ] then
81- headers [" Transfer-Encoding " ] = " chunked"
80+ if not headers [" content-length " ] then
81+ headers [" transfer-encoding " ] = " chunked"
8282 end
8383
84- if not headers [" Content-Type " ] and config .use_default_type then
85- headers [" Content-Type " ] = " application/octet-stream"
84+ if not headers [" content-type " ] and config .use_default_type then
85+ headers [" content-type " ] = " application/octet-stream"
8686 end
8787
8888 elseif is_str (body ) then
89- headers [" Content-Length " ] = # body
90- headers [" Transfer-Encoding " ] = nil
89+ headers [" content-length " ] = # body
90+ headers [" transfer-encoding " ] = nil
9191
92- if not headers [" Content-Type " ] and config .use_default_type then
93- headers [" Content-Type " ] = " text/plain"
92+ if not headers [" content-type " ] and config .use_default_type then
93+ headers [" content-type " ] = " text/plain"
9494 end
9595
9696 elseif is_tab (body ) then
97- if not headers [" Content-Type " ] and config .use_default_type then
98- headers [" Content-Type " ] = " application/x-www-form-urlencoded"
97+ if not headers [" content-type " ] and config .use_default_type then
98+ headers [" content-type " ] = " application/x-www-form-urlencoded"
9999 end
100100
101101 local param = new_tab (4 , 0 )
@@ -104,24 +104,24 @@ local function prepare(url_parts, session, config)
104104 end
105105
106106 content = concat (param , " &" )
107- headers [" Content-Length " ] = # content
108- headers [" Transfer-Encoding " ] = nil
107+ headers [" content-length " ] = # content
108+ headers [" transfer-encoding " ] = nil
109109 end
110110 end
111111
112- if not headers [" Host " ] then
113- headers [" Host " ] = url_parts .host
112+ if not headers [" host " ] then
113+ headers [" host " ] = url_parts .host
114114 end
115115
116- if headers [" Transfer-Encoding " ] then
117- headers [" Content-Length " ] = nil
116+ if headers [" transfer-encoding " ] then
117+ headers [" content-length " ] = nil
118118 end
119119
120- headers [" Connection " ] = " keep-alive"
120+ headers [" connection " ] = " keep-alive"
121121
122122 local auth = session .auth
123123 if auth then
124- headers [" Authorization " ] = auth
124+ headers [" authorization " ] = auth
125125 end
126126
127127 local cookie = session .cookie
@@ -131,7 +131,7 @@ local function prepare(url_parts, session, config)
131131 insert (plain , (" %s=%s" ):format (k , v ))
132132 end
133133
134- headers [" Cookie " ] = concat (plain , " ; " )
134+ headers [" cookie " ] = concat (plain , " ; " )
135135 end
136136
137137 return content
@@ -146,7 +146,7 @@ local function new(method, url, session, config)
146146
147147 local body = prepare (url_parts , session , config )
148148
149- local expect = session .headers [" Expect " ] == " 100-continue"
149+ local expect = session .headers [" expect " ] == " 100-continue"
150150
151151 local r = {
152152 method = method ,
0 commit comments