@@ -2,7 +2,6 @@ local utils = require("rest-nvim.utils")
22local path = require (" plenary.path" )
33local log = require (" plenary.log" ).new ({ plugin = " rest.nvim" , level = " warn" })
44
5-
65-- get_importfile returns in case of an imported file the absolute filename
76-- @param bufnr Buffer number, a.k.a id
87-- @param stop_line Line to stop searching
@@ -19,11 +18,13 @@ local function get_importfile_name(bufnr, start_line, stop_line)
1918 local fileimport_string
2019 local fileimport_line
2120 fileimport_line = vim .api .nvim_buf_get_lines (bufnr , import_line - 1 , import_line , false )
22- fileimport_string = string.gsub (fileimport_line [1 ], " <" , " " , 1 ):gsub (" ^%s+" , " " ):gsub (" %s+$" , " " )
21+ fileimport_string = string.gsub (fileimport_line [1 ], " <" , " " , 1 )
22+ :gsub (" ^%s+" , " " )
23+ :gsub (" %s+$" , " " )
2324 -- local fileimport_path = path:new(fileimport_string)
2425 -- if fileimport_path:is_absolute() then
2526 if path :new (fileimport_string ):is_absolute () then
26- return fileimport_string
27+ return fileimport_string
2728 else
2829 local file_dirname = vim .fn .expand (" %:p:h" )
2930 local file_name = path :new (path :new (file_dirname ), fileimport_string )
@@ -49,7 +50,7 @@ local function get_body(bufnr, start_line, stop_line)
4950 local lines
5051 if importfile ~= nil then
5152 if not utils .file_exists (importfile ) then
52- error (" import file " .. importfile .. " not found" )
53+ error (" import file " .. importfile .. " not found" )
5354 end
5455 lines = utils .read_file (importfile )
5556 else
@@ -115,7 +116,6 @@ local function get_headers(bufnr, start_line, end_line)
115116 return headers , body_start
116117end
117118
118-
119119-- start_request will find the request line (e.g. POST http://localhost:8081/foo)
120120-- of the current request and returns the linenumber of this request line.
121121-- The current request is defined as the next request line above the cursor
@@ -176,11 +176,11 @@ M.get_current_request = function()
176176 local body = get_body (bufnr , body_start , end_line )
177177
178178 return {
179- method = parsed_url .method ,
180- url = parsed_url .url ,
181- headers = headers ,
182- body = body ,
183- }
179+ method = parsed_url .method ,
180+ url = parsed_url .url ,
181+ headers = headers ,
182+ body = body ,
183+ }
184184end
185185
186186return M
0 commit comments