@@ -112,8 +112,7 @@ local function get_headers(bufnr, start_line, end_line)
112112
113113 -- Iterate over all buffer lines starting after the request line
114114 for line_number = start_line + 1 , end_line do
115- local line = vim .fn .getbufline (bufnr , line_number )
116- local line_content = line [1 ]
115+ local line_content = vim .fn .getbufline (bufnr , line_number )[1 ]
117116
118117 -- message header and message body are seperated by CRLF (see RFC 2616)
119118 -- for our purpose also the next request line will stop the header search
@@ -146,11 +145,24 @@ local function get_curl_args(bufnr, headers_end, end_line)
146145 local body_start = end_line
147146
148147 for line_number = headers_end , end_line do
149- local line = vim .fn .getbufline (bufnr , line_number )
150- local line_content = line [1 ]
148+ local line_content = vim .fn .getbufline (bufnr , line_number )[1 ]
151149
152150 if line_content :find (" ^ *%-%-?[a-zA-Z%-]+" ) then
153- table.insert (curl_args , line_content )
151+ local lc = vim .split (line_content , " " )
152+ local x = " "
153+
154+ for i , y in ipairs (lc ) do
155+ x = x .. y
156+
157+ if # y :match (" \\ *$" ) % 2 == 1 and i ~= # lc then
158+ -- insert space if there is an slash at end
159+ x = x .. " "
160+ else
161+ -- insert 'x' into curl_args and reset it
162+ table.insert (curl_args , x )
163+ x = " "
164+ end
165+ end
154166 elseif not line_content :find (" ^ *$" ) then
155167 if line_number ~= end_line then
156168 body_start = line_number - 1
0 commit comments