Skip to content

refactor(convert_output): remove {httr} dependency and switch URL validation to base R - #305

Merged
Schiano-NOAA merged 2 commits into
mainfrom
copilot/refactor-eliminate-httr-base-r
Jul 21, 2026
Merged

refactor(convert_output): remove {httr} dependency and switch URL validation to base R#305
Schiano-NOAA merged 2 commits into
mainfrom
copilot/refactor-eliminate-httr-base-r

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

convert_output() used {httr} only for URL existence checks, making {httr} an unnecessary runtime dependency. This PR replaces that check with base R (utils::curlGetHeaders) and removes {httr} from package imports.

  • URL validation refactor (base R)

    • Replaced httr::HEAD() + httr::status_code() with utils::curlGetHeaders() in convert_output().
    • Kept existing behavior for invalid URLs by mapping header-fetch failures to 404 and emitting cli::cli_abort("Invalid URL.").
  • Dependency cleanup

    • Removed httr from DESCRIPTION Imports.
  • Focused coverage update

    • Added a testthat case asserting an invalid URL input triggers "Invalid URL.".
check <- tryCatch({
  headers <- utils::curlGetHeaders(file)
  attributes(headers)[["status"]]
}, error = function(e) {
  404
})
if (check == 404) cli::cli_abort(c(message = "Invalid URL."))

Copilot AI changed the title [WIP] Refactor to eliminate {httr} using base R refactor(convert_output): remove {httr} dependency and switch URL validation to base R Jul 20, 2026
Copilot AI requested a review from Schiano-NOAA July 20, 2026 19:32
@Schiano-NOAA
Schiano-NOAA marked this pull request as ready for review July 21, 2026 17:52

@Schiano-NOAA Schiano-NOAA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Going to wait for checks to run before merging

@Schiano-NOAA
Schiano-NOAA merged commit b9f6117 into main Jul 21, 2026
8 checks passed
@Schiano-NOAA
Schiano-NOAA deleted the copilot/refactor-eliminate-httr-base-r branch July 21, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor]: eliminate {httr} using base R

2 participants