@@ -13,7 +13,7 @@ get_base_req <- function() {
1313 .pkg_env $ base_req
1414}
1515
16- make_request <- function (path , token = NULL , method = " GET" ) {
16+ make_request <- function (path , token = NULL , method = " GET" , file = NULL ) {
1717 rlang :: check_installed(" httr2" )
1818 req <- httr2 :: req_url_path(get_base_req(), path )
1919 req <- httr2 :: req_method(req , method )
@@ -24,7 +24,7 @@ make_request <- function(path, token = NULL, method = "GET") {
2424 req <- httr2 :: req_headers(req , `WWW-Authenticate` = token )
2525 }
2626
27- resp <- httr2 :: req_perform(req )
27+ resp <- httr2 :: req_perform(req , path = file )
2828
2929 if (httr2 :: resp_status(resp ) != 200 ) {
3030 stop(" Failed to download file. Status: " , httr2 :: resp_status(resp ))
@@ -63,8 +63,8 @@ download_file <- function(zip_url, token = NULL, file, size_limit) {
6363 " i" = " To download the file, set {.arg size_limit} to a value greater than {gb_size}"
6464 ))
6565 }
66- resp <- make_request(zip_url , token , method = " GET" )
67- writeBin(httr2 :: resp_body_raw(resp ), file )
66+ resp <- make_request(zip_url , token , method = " GET" , file = file )
67+ # writeBin(httr2::resp_body_raw(resp), file)
6868 invisible (NULL )
6969}
7070
0 commit comments