Skip to content

Commit 2a1e6d9

Browse files
Format source code
1 parent 0f831d9 commit 2a1e6d9

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

lua/rest-nvim/curl/init.lua

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,37 +108,29 @@ local function create_callback(method, url)
108108
if ok and out then
109109
res.body = out
110110
else
111-
vim.api.nvim_echo(
111+
vim.api.nvim_echo({
112112
{
113-
{
114-
string.format("Error calling formatter on response body:\n%s", out),
115-
"Error",
116-
},
113+
string.format("Error calling formatter on response body:\n%s", out),
114+
"Error",
117115
},
118-
false,
119-
{}
120-
)
116+
}, false, {})
121117
end
122118
elseif is_executable(formatter) then
123119
local stdout = vim.fn.system(formatter, res.body):gsub("\n$", "")
124120
-- check if formatter ran successfully
125121
if vim.v.shell_error == 0 then
126122
res.body = stdout
127123
else
128-
vim.api.nvim_echo(
124+
vim.api.nvim_echo({
129125
{
130-
{
131-
string.format(
132-
"Error running formatter %s on response body:\n%s",
133-
vim.inspect(formatter),
134-
stdout
135-
),
136-
"Error",
137-
},
126+
string.format(
127+
"Error running formatter %s on response body:\n%s",
128+
vim.inspect(formatter),
129+
stdout
130+
),
131+
"Error",
138132
},
139-
false,
140-
{}
141-
)
133+
}, false, {})
142134
end
143135
end
144136

lua/rest-nvim/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ rest.run = function(verbose)
4848
if not success_req then
4949
vim.api.nvim_err_writeln(
5050
"[rest.nvim] Failed to perform the request.\nMake sure that you have entered the proper URL and the server is running.\n\nTraceback: "
51-
.. req_err
51+
.. req_err
5252
)
5353
end
5454
end
@@ -69,7 +69,7 @@ rest.last = function()
6969
if not success_req then
7070
vim.api.nvim_err_writeln(
7171
"[rest.nvim] Failed to perform the request.\nMake sure that you have entered the proper URL and the server is running.\n\nTraceback: "
72-
.. req_err
72+
.. req_err
7373
)
7474
end
7575
end

lua/rest-nvim/request/init.lua

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ local function get_importfile_name(bufnr, start_line, stop_line)
1919
local fileimport_string
2020
local fileimport_line
2121
fileimport_line = vim.api.nvim_buf_get_lines(bufnr, import_line - 1, import_line, false)
22-
fileimport_string = string.gsub(fileimport_line[1], "<", "", 1)
23-
:gsub("^%s+", "")
24-
:gsub("%s+$", "")
22+
fileimport_string =
23+
string.gsub(fileimport_line[1], "<", "", 1):gsub("^%s+", ""):gsub("%s+$", "")
2524
-- local fileimport_path = path:new(fileimport_string)
2625
-- if fileimport_path:is_absolute() then
2726
if path:new(fileimport_string):is_absolute() then
@@ -215,7 +214,7 @@ local function parse_url(stmt)
215214
method = http_method,
216215
-- Encode URL
217216
url = utils.encode_url(utils.replace_vars(target_url)),
218-
http_version = http_version
217+
http_version = http_version,
219218
}
220219
end
221220

@@ -236,12 +235,11 @@ M.get_current_request = function()
236235

237236
local curl_args, body_start = get_curl_args(bufnr, headers_end, end_line)
238237

239-
240-
if headers['host'] ~= nil then
241-
headers['host'] = headers['host']:gsub("%s+", "")
242-
headers['host'] = string.gsub(headers['host'], "%s+", "")
243-
parsed_url.url = headers['host'] .. parsed_url.url
244-
headers['host'] = nil
238+
if headers["host"] ~= nil then
239+
headers["host"] = headers["host"]:gsub("%s+", "")
240+
headers["host"] = string.gsub(headers["host"], "%s+", "")
241+
parsed_url.url = headers["host"] .. parsed_url.url
242+
headers["host"] = nil
245243
end
246244

247245
local body = get_body(

0 commit comments

Comments
 (0)