Skip to content

Commit d6aeecb

Browse files
committed
fix: get_auth was always returning nil
1 parent a6decd3 commit d6aeecb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lua/rest-nvim/init.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,18 @@ end
200200
-- @param query_line Line to set cursor position
201201
local function get_auth(bufnr, query_line)
202202
local auth = {}
203-
local auth_not_empty = false
203+
local is_auth_empty = true
204204
-- Set stop at end of bufer
205205
local stop_line = fn.line('$')
206206

207207
-- Iterate over all buffer lines
208208
for _ = 1, stop_line do
209209
-- Case-insensitive search
210210
local start_line = fn.search('\\cAuthorization:', '', stop_line)
211+
if start_line ~= 0 then
212+
is_auth_empty = false
213+
end
214+
211215
local end_line = start_line
212216
local auth_line = api.nvim_buf_get_lines(
213217
bufnr,
@@ -227,7 +231,7 @@ local function get_auth(bufnr, query_line)
227231
end
228232

229233
go_to_line(bufnr, query_line)
230-
if not auth_not_empty then
234+
if is_auth_empty then
231235
return nil
232236
end
233237
return auth

0 commit comments

Comments
 (0)