@@ -20,8 +20,8 @@ local function get_importfile_name(bufnr, start_line, stop_line)
2020 local fileimport_line
2121 fileimport_line = vim .api .nvim_buf_get_lines (bufnr , import_line - 1 , import_line , false )
2222 fileimport_string = string.gsub (fileimport_line [1 ], " <" , " " , 1 )
23- :gsub (" ^%s+" , " " )
24- :gsub (" %s+$" , " " )
23+ :gsub (" ^%s+" , " " )
24+ :gsub (" %s+$" , " " )
2525 -- local fileimport_path = path:new(fileimport_string)
2626 -- if fileimport_path:is_absolute() then
2727 if path :new (fileimport_string ):is_absolute () then
@@ -78,6 +78,7 @@ local function get_body(bufnr, start_line, stop_line)
7878
7979 return body
8080end
81+
8182-- is_request_line checks if the given line is a http request line according to RFC 2616
8283local function is_request_line (line )
8384 local http_methods = { " GET" , " POST" , " PUT" , " PATCH" , " DELETE" }
@@ -193,6 +194,13 @@ M.get_current_request = function()
193194
194195 local headers , body_start = get_headers (bufnr , start_line , end_line )
195196
197+ if headers [' host' ] ~= nil then
198+ headers [' host' ] = headers [' host' ]:gsub (" %s+" , " " )
199+ headers [' host' ] = string.gsub (headers [' host' ], " %s+" , " " )
200+ parsed_url .url = headers [' host' ] .. parsed_url .url
201+ headers [' host' ] = nil
202+ end
203+
196204 local body = get_body (bufnr , body_start , end_line )
197205
198206 if config .get (" jump_to_request" ) then
0 commit comments