@@ -4,12 +4,13 @@ github_GET <- function(path, ..., host = "api.github.com", pat = github_pat(), u
44 url <- build_url(host , path )
55
66 if (isTRUE(use_curl )) {
7- h <- curl :: new_handle()
87 headers <- c(
98 if (! is.null(pat )) {
109 c(" Authorization" = paste0(" token " , pat ))
1110 }
1211 )
12+
13+ h <- curl :: new_handle()
1314 curl :: handle_setheaders(h , .list = headers )
1415 res <- curl :: curl_fetch_memory(url , handle = h )
1516
@@ -31,7 +32,6 @@ github_commit <- function(username, repo, ref = "HEAD",
3132 url <- build_url(host , " repos" , username , repo , " commits" , utils :: URLencode(ref , reserved = TRUE ))
3233
3334 if (isTRUE(use_curl )) {
34- h <- curl :: new_handle()
3535 headers <- c(
3636 " Accept" = " application/vnd.github.v3.sha" ,
3737 if (! is.null(pat )) {
@@ -42,6 +42,7 @@ github_commit <- function(username, repo, ref = "HEAD",
4242 }
4343 )
4444
45+ h <- curl :: new_handle()
4546 curl :: handle_setheaders(h , .list = headers )
4647 res <- curl :: curl_fetch_memory(url , handle = h )
4748 if (res $ status_code == 304 ) {
@@ -116,14 +117,14 @@ github_DESCRIPTION <- function(username, repo, subdir = NULL, ref = "HEAD", host
116117 url <- paste0(url , " ?ref=" , utils :: URLencode(ref ))
117118
118119 if (isTRUE(use_curl )) {
119- h <- curl :: new_handle()
120120 headers <- c(
121121 " Accept" = " application/vnd.github.v3.raw" ,
122122 if (! is.null(pat )) {
123123 c(" Authorization" = paste0(" token " , pat ))
124124 }
125125 )
126126
127+ h <- curl :: new_handle()
127128 curl :: handle_setheaders(h , .list = headers )
128129 res <- curl :: curl_fetch_memory(url , handle = h )
129130 if (res $ status_code > = 300 ) {
0 commit comments