mirror of
https://github.com/neovim/neovim.git
synced 2026-07-12 20:30:35 +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
|
elseif res.code ~= 0 then
|
||||||
err = res.stderr ~= '' and res.stderr or ('Request failed with exit code %d'):format(res.code)
|
err = res.stderr ~= '' and res.stderr or ('Request failed with exit code %d'):format(res.code)
|
||||||
else
|
else
|
||||||
if not (opts.outpath or opts.outbuf) then
|
if on_response then
|
||||||
response = {
|
response = {
|
||||||
body = res.stdout --[[@as string]],
|
body = res.stdout --[[@as string]],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user