Skip to content

Use curl, not httr, for Require's token-authenticated GitHub downloads - #256

Merged
eliotmcintire merged 1 commit into
chore/drop-unused-suggestsfrom
chore/httr-to-curl
Dec 5, 2026
Merged

eliotmcintire merged 1 commit into
chore/drop-unused-suggestsfrom
chore/httr-to-curl

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

Require downloads files from private GitHub repositories with a personal access token. These downloads now use curl, which Require already depends on, so they no longer need httr. The exported helper that other packages call keeps working exactly as before.

Affects: Users downloading from private GitHub repositories no longer need httr installed; nothing else changes.

Depends-on: #255

Technical details
  • New internal curlGETauth() / curlGET() (R/Require-helpers.R) use curl::new_handle(), handle_setheaders() and curl_fetch_memory(). Like the httr version, it retries without the token on "Bad credentials" or a 404.
  • .downloadFileMasterMainAuth() calls curlGETauth(), writes a$content with writeBin(), and stops on a 404.
  • checkForToken() checks for curl instead of httr.
  • The exported GETWauthThenNonAuth() keeps its httr code and Rd, because SpaDES.core calls it through getFromNamespace() and reads the result with httr::stop_for_status() / httr::content(). httr stays in Suggests for it.
  • Tests: test-28 has a new curlGETauth test (token sent, then a retry without it), and the httr test of GETWauthThenNonAuth() is kept. Mocks in test-28 and test-31 now target curlGETauth.
  • Tested with a real token: the curl download wrote the DESCRIPTION file, and GETWauthThenNonAuth() still returns an httr response.
  • Full local devtools::test() (NOT_CRAN=true): 564 tests, 2496 passed, 0 failed, 0 errors, 0 warnings, 0 skipped.
  • Version 2.1.1.9057.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

…uthThenNonAuth() stays on httr

.downloadFileMasterMainAuth() now uses a new internal curlGETauth()
(curl::curl_fetch_memory(), same bad-credentials/404 fallback). The exported
GETWauthThenNonAuth() is unchanged and still returns an httr response,
because SpaDES.core (module-repository.R) reads it with httr::content() and
httr::stop_for_status(); httr stays in Suggests for it. checkForToken() now
needs curl, not httr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Existing code and results keep working unchanged labels Dec 5, 2026
@eliotmcintire
eliotmcintire merged commit 540a15c into chore/drop-unused-suggests Dec 5, 2026
1 check passed
@eliotmcintire
eliotmcintire deleted the chore/httr-to-curl branch December 5, 2026 04:49
eliotmcintire added a commit that referenced this pull request Dec 5, 2026
…folder without rprojroot (#255)

* Drop unused packages from Suggests; setupOff finds the .Rproj folder with base R (no rprojroot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

* Require's token-authenticated GitHub downloads go through curl; GETWauthThenNonAuth() stays on httr (#256)

.downloadFileMasterMainAuth() now uses a new internal curlGETauth()
(curl::curl_fetch_memory(), same bad-credentials/404 fallback). The exported
GETWauthThenNonAuth() is unchanged and still returns an httr response,
because SpaDES.core (module-repository.R) reads it with httr::content() and
httr::stop_for_status(); httr stays in Suggests for it. checkForToken() now
needs curl, not httr.


Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatible Existing code and results keep working unchanged enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant