-
Notifications
You must be signed in to change notification settings - Fork 51
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
Switch from httr to httr2 #174
Conversation
@gaborcsardi if we decided to go down this path, I'll consider testing more broadly, doing some more refactoring and adding tests to get better coverage. But I have invested relatively little time at this point, so it would be easier enough to give it up. A few reasons why it'd be worthwhile to switch to httr2:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with switching to httr2, it also helps httr2 to get more usage.
Looks good, I left some comments. In particular, we could make sure that returning list()
for an empty response does not break anything in usethis.
Some tests cases are failing for me, I think these might be fragile.
Failure (test-gh_whoami.R:10): whoami works in presence of PAT
res\[\["scopes"\]\] does not match "\\buser\\b".
Actual value: "delete:packages, delete_repo, read:org, repo, workflow, write:packages"
Backtrace:
1. testthat::expect_match(res[["scopes"]], "\\buser\\b")
at test-gh_whoami.R:10:2
2. testthat:::expect_match_(...)
Error (test-mock-repos.R:33): can POST, PATCH, and DELETE
<github_error/http_error_404/rlang_error/error/condition>
Error in `gh_process_response(raw)`: GitHub API error (404): Not Found
x URL not found: <https://api.github.com/gists>
i Read more at <https://docs.github.com/rest/reference/gists#create-a-gist>
Backtrace:
1. gh::gh(...)
at test-mock-repos.R:33:2
2. gh:::gh_process_response(raw)
at gh/R/gh.R:176:2
Error (test-mock-repos.R:33): can POST, PATCH, and DELETE
<github_error/http_error_404/rlang_error/error/condition>
Error in `gh_process_response(raw)`: GitHub API error (404): Not Found
x URL not found: <https://api.github.com/gists>
i Read more at <https://docs.github.com/rest/reference/gists#create-a-gist>
Backtrace:
1. gh::gh(...)
at test-mock-repos.R:33:2
2. gh:::gh_process_response(raw)
at gh/R/gh.R:176:2
Co-authored-by: Gábor Csárdi <csardi.gabor@gmail.com>
And flow call information through
Hmmm, those tests assume that you have a PAT created with our default scopes. I can skip if the scopes aren't as expected, if you want. |
Yeah, I think we need to skip, or add back the |
And add rate limiting. Fixes #67.