diff --git a/lua/gemini/api.lua b/lua/gemini/api.lua index f1d4564..c3d2c76 100644 --- a/lua/gemini/api.lua +++ b/lua/gemini/api.lua @@ -53,8 +53,8 @@ local function async_request(url, payload, callback) return end - local ssl = vim.loop.new_tls() - ssl:wrap(client) + -- Create TLS wrapper + local tls_client = vim.loop.new_tls_wrap(client) local request = string.format( "POST %s HTTP/1.1\r\n" .. @@ -68,7 +68,7 @@ local function async_request(url, payload, callback) local response = "" - ssl:write(request, function(err) + tls_client:write(request, function(err) if err then vim.schedule(function() callback(nil, "Write error: " .. err) @@ -76,7 +76,7 @@ local function async_request(url, payload, callback) return end - ssl:read_start(function(err, chunk) + tls_client:read_start(function(err, chunk) if err then vim.schedule(function() callback(nil, "Read error: " .. err) @@ -99,7 +99,7 @@ local function async_request(url, payload, callback) end end) - ssl:close() + tls_client:close() client:close() end end)