aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/net.lua
diff options
context:
space:
mode:
authorYochem van Rosmalen <git@yochem.nl>2026-03-24 12:30:00 +0100
committerGitHub <noreply@github.com>2026-03-24 07:30:00 -0400
commit10ca09a2cbe4546a67cfc2ca99eed806077416a5 (patch)
tree12d46a56c2109493004d60198f6bf4cfa8072682 /runtime/lua/vim/net.lua
parentebc981114973c33b22413469c1db23b60506e181 (diff)
downloadrneovim-10ca09a2cbe4546a67cfc2ca99eed806077416a5.tar.gz
rneovim-10ca09a2cbe4546a67cfc2ca99eed806077416a5.tar.bz2
rneovim-10ca09a2cbe4546a67cfc2ca99eed806077416a5.zip
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.
Diffstat (limited to 'runtime/lua/vim/net.lua')
-rw-r--r--runtime/lua/vim/net.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/net.lua b/runtime/lua/vim/net.lua
index b678b0bb2c..acf6a44ccc 100644
--- a/runtime/lua/vim/net.lua
+++ b/runtime/lua/vim/net.lua
@@ -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]],
}