aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/net.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-04-12 08:45:46 -0400
committerGitHub <noreply@github.com>2026-04-12 08:45:46 -0400
commit52d466c500fcb0a87cfe56dc5c8cd63db67d612a (patch)
treec17cef4bf5846cd125d8bde18bd61d38584a083f /runtime/lua/vim/net.lua
parent6e95d1ad138cb25e04ef98c95f93d1a7af8c1f49 (diff)
parent30a80cbd7c688f32aa79fa764f330ea64e303657 (diff)
downloadrneovim-52d466c500fcb0a87cfe56dc5c8cd63db67d612a.tar.gz
rneovim-52d466c500fcb0a87cfe56dc5c8cd63db67d612a.tar.bz2
rneovim-52d466c500fcb0a87cfe56dc5c8cd63db67d612a.zip
Merge #38882 docs
Diffstat (limited to 'runtime/lua/vim/net.lua')
-rw-r--r--runtime/lua/vim/net.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/runtime/lua/vim/net.lua b/runtime/lua/vim/net.lua
index d8bf5f1eb7..6d63fdc77f 100644
--- a/runtime/lua/vim/net.lua
+++ b/runtime/lua/vim/net.lua
@@ -15,9 +15,8 @@ local M = {}
---Buffer to save the response body to.
---@field outbuf? integer
---
----Table of custom headers to send with the request.
----Supports basic key/value header formats and empty headers as supported by curl.
----Does not support @filename style, internal header deletion (e.g: 'Header:').
+---Custom headers to send with the request. Supports basic key/value headers and empty headers as
+---supported by curl. Does not support "@filename" style, internal header deletion ("Header:").
---@field headers? table<string, string>
---@class vim.net.request.Response
@@ -30,12 +29,12 @@ local M = {}
---
--- Examples:
--- ```lua
---- -- Write response body to file
+--- -- Write response body to file.
--- vim.net.request('https://neovim.io/charter/', {
--- outpath = 'vision.html',
--- })
---
---- -- Process the response
+--- -- Process the response.
--- vim.net.request(
--- 'https://api.github.com/repos/neovim/neovim',
--- {},
@@ -46,14 +45,14 @@ local M = {}
--- end
--- )
---
---- -- Write to both file and current buffer, but cancel it
+--- -- Write to both file and current buffer, but cancel it.
--- local job = vim.net.request('https://neovim.io/charter/', {
--- outpath = 'vision.html',
--- outbuf = 0,
--- })
--- job:close()
---
---- -- Add custom headers in the request
+--- -- Add custom headers in the request.
--- vim.net.request('https://neovim.io/charter/', {
--- headers = { Authorization = 'Bearer XYZ' },
--- })
@@ -64,7 +63,7 @@ local M = {}
--- @param on_response? fun(err: string?, response: vim.net.request.Response?)
--- Callback invoked on request completion. The `body` field in the response
--- parameter contains the raw response data (text or binary).
---- @return { close: fun() } # Table with method to cancel, similar to [vim.SystemObj].
+--- @return { close: fun() } # Object with `close()` method which cancels the request.
function M.request(url, opts, on_response)
vim.validate('url', url, 'string')
vim.validate('opts', opts, 'table', true)