Skip to content

Commit

Permalink
fix(hurl): Improve HurlRunnerToEntry command and remove unnecessary log
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Mar 14, 2024
1 parent 1b7b2c8 commit 4d4e4ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lua/hurl/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ local function run_at_lines(start_line, end_line, opts, callback)
local lines = vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false)

if not lines or vim.tbl_isempty(lines) then
utils.log_warn('hurl: no lines to run')
utils.notify('hurl: no lines to run', vim.log.levels.WARN)
return
end
Expand Down Expand Up @@ -373,11 +372,9 @@ function M.setup()
-- Run request to current entry if there is a HTTP method
utils.create_cmd('HurlRunnerToEntry', function(opts)
local result = http.find_hurl_entry_positions_in_buffer()
utils.log_info('hurl: running request to entry #' .. vim.inspect(result))
if result.current > 0 then
opts.fargs = opts.fargs or {}
opts.fargs = vim.list_extend(opts.fargs, { '--to-entry', result.current })
utils.log_info('hurl: running request to entry #' .. vim.inspect(result))
run_current_file(opts.fargs)
run_at_lines(1, result.end_line, opts.fargs)
else
utils.log_info('hurl: not HTTP method found in the current line' .. result.end_line)
utils.notify('hurl: no HTTP method found in the current line', vim.log.levels.INFO)
Expand Down
1 change: 1 addition & 0 deletions test/dogs.hurl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Get breeds and then get the first breed
GET https://dogapi.dog/api/v2/breeds

HTTP 200
Expand Down

0 comments on commit 4d4e4ff

Please sign in to comment.