Get rid of curl
This commit is contained in:
parent
39147fb21e
commit
2fbcf6c33e
@ -25,7 +25,26 @@ function Request:execute(callback)
|
||||
|
||||
local response_data = ""
|
||||
|
||||
client:connect("generativelanguage.googleapis.com", 443, function(err)
|
||||
vim.loop.getaddrinfo("generativelanguage.googleapis.com", "443", {
|
||||
family = "inet",
|
||||
socktype = "stream",
|
||||
protocol = "tcp"
|
||||
}, function(err, res)
|
||||
if err then
|
||||
vim.schedule(function()
|
||||
callback(nil, "DNS resolution failed: " .. err)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
if not res or #res == 0 then
|
||||
vim.schedule(function()
|
||||
callback(nil, "Could not resolve hostname")
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
client:connect(res[1].addr, res[1].port, function(err)
|
||||
if err then
|
||||
vim.schedule(function()
|
||||
callback(nil, "Connection failed: " .. err)
|
||||
@ -72,6 +91,7 @@ function Request:execute(callback)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
M.Request = Request
|
||||
|
Loading…
x
Reference in New Issue
Block a user