Skip to content

Commit 68df1c2

Browse files
committed
fix osx curl issue
1 parent b71fcd5 commit 68df1c2

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lua/copilot/setup.lua

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
local config_root = vim.fn.expand('~/.config') .. "/github-copilot/hosts.json"
2-
local config_hosts = config_root .. "/hosts.json"
3-
local request = require('plenary.curl').request
4-
local post = require('plenary.curl').post
5-
61
local M = {}
72

83
local function find_config_path()
@@ -18,14 +13,9 @@ local function json_body(response)
1813
return vim.fn.json_decode(response.body)
1914
end
2015
end
16+
2117
local function oauth_user(token)
22-
local response = request({
23-
url = "https://api.github.com/user",
24-
headers = {
25-
Authorization = "Bearer " .. token,
26-
},
27-
})
28-
return json_body(response)
18+
return vim.fn.json_decode(vim.fn.system("curl -s --header \"Authorization: Bearer " .. token .. "\" https://api.github.com/user"))
2919
end
3020

3121
local function oauth_save(oauth_token)

0 commit comments

Comments
 (0)