Skip to content

Use {httr2}, not {httr} #2148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MichaelChirico opened this issue Sep 12, 2023 · 0 comments · Fixed by #2446
Closed

Use {httr2}, not {httr} #2148

MichaelChirico opened this issue Sep 12, 2023 · 0 comments · Fixed by #2446
Labels
internals Issues related to inner workings of lintr, i.e., not user-visible
Milestone

Comments

@MichaelChirico
Copy link
Collaborator

{httr} is superseded in favor of {httr2}. We don't have much usage, so it should be "easy" to refactor in favor of the newer/better-supported package:

lintr/R/comments.R

Lines 85 to 115 in 203be65

github_comment <- function(text, info = NULL, token = settings$comment_token) {
if (!requireNamespace("httr", quietly = TRUE)) {
stop("Package 'httr' is required to post comments with github_comment().")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
stop("Package 'jsonlite' is required to post comments with github_comment().")
}
if (is.null(info)) {
info <- ci_build_info()
}
if (!is.null(info$pull) && info$pull != "false") {
api_subdir <- file.path("issues", info$pull)
} else if (!is.null(info$commit)) {
api_subdir <- file.path("commits", info$commit)
} else {
stop("Expected a pull or a commit, but received ci_build_info() = ", format(info))
}
response <- httr::POST(
"https://api.github.com",
path = file.path("repos", info$user, info$repo, api_subdir, "comments"),
body = list(body = jsonlite::unbox(text)),
query = list(access_token = token),
encode = "json"
)
if (httr::status_code(response) >= 300L) {
message(httr::http_condition(response, "error", task = httr::content(response, as = "text")))
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Issues related to inner workings of lintr, i.e., not user-visible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant