mirror of
https://github.com/neovim/neovim.git
synced 2026-03-27 19:02:02 +00:00
fix(vim.net): always pass response body to on_response #38460
Problem: on_response(err, response) handler doesn't receive a response when an output buffer or path is supplied to vim.net.request. User might want to both output output to a file/buffer and also do something with it on response. Solution: If an on_response handler was given, then pass the response to it.
This commit is contained in:
committed by
GitHub
parent
ebc9811149
commit
10ca09a2cb
@@ -86,7 +86,7 @@ function M.request(url, opts, on_response)
|
||||
elseif res.code ~= 0 then
|
||||
err = res.stderr ~= '' and res.stderr or ('Request failed with exit code %d'):format(res.code)
|
||||
else
|
||||
if not (opts.outpath or opts.outbuf) then
|
||||
if on_response then
|
||||
response = {
|
||||
body = res.stdout --[[@as string]],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user