Skip to content

Commit

Permalink
fix: ignore commented lines as it should be
Browse files Browse the repository at this point in the history
  • Loading branch information
NTBBloodbath committed Jun 30, 2021
1 parent f04b205 commit 0096462
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lua/rest-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ local function get_body(bufnr, stop_line, query_line, json_body)
false
)

for _, v in ipairs(json_lines) do
json_string = json_string .. utils.replace_env_vars(v)
for _, json_line in ipairs(json_lines) do
if json_line:find('^#') == nil then
json_string = json_string .. utils.replace_env_vars(json_line)
end
end

json_string = '{' .. json_string .. '}'
Expand Down Expand Up @@ -182,7 +184,9 @@ local function get_accept(bufnr, query_line)
)

for _, accept_data in pairs(accept_line) do
accept = utils.split(accept_data, ':')[2]
if accept_data:find('^#') == nil then
accept = utils.split(accept_data, ':')[2]
end
end
end

Expand Down Expand Up @@ -213,10 +217,12 @@ local function get_auth(bufnr, query_line)
)

for _, auth_data in pairs(auth_line) do
-- Split by spaces, e.g. {'Authorization:', 'user:pass'}
auth_data = utils.split(auth_data, '%s+')
-- {'user', 'pass'}
auth = utils.split(utils.replace_env_vars(auth_data[2]), ':')
if auth_data:find('^#') == nil then
-- Split by spaces, e.g. {'Authorization:', 'user:pass'}
auth_data = utils.split(auth_data, '%s+')
-- {'user', 'pass'}
auth = utils.split(utils.replace_env_vars(auth_data[2]), ':')
end
end
end

Expand Down

0 comments on commit 0096462

Please sign in to comment.