8000 FIX unknown status code (#567) by Javdat · Pull Request #585 · r-lib/httr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

FIX unknown status code (#567) #585

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

Merged
merged 1 commit into from
Apr 28, 2019
Merged

Conversation

Javdat
Copy link
Contributor
@Javdat Javdat commented Apr 8, 2019

Fixes issue (#567) with unknown status code. Slightly modified solution from original offered by @hadley.

@@ -46,11 +46,12 @@ status_code.numeric <- function(x) x
http_status <- function(x) {
status <- status_code(x)

status_desc <- http_statuses[[as.character(status)]]
if (is.na(status_desc)) {
if (isFALSE(status %in% names(http_statuses))) {
Copy link
Member

Choose a reason for hiding this comment

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

isFALSE() isn't a good approach here because it's only available in recent versions of R, and it's strictness isn't needed as we know that %in% always returns a logical vector with the same length as the LHS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isFALSE was here mostly to handle cases if status is NA for some reason. But apparently, %in% already handles it as well. Force changed the code.

@Javdat Javdat force-pushed the bugfix/unkown_status branch from 1c9aa6e to 9af70f8 Compare April 10, 2019 15:23
Copy link
Member
@hadley hadley left a comment

Choose a reason for hiding this comment

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

Can you please add a bullet to NEWS? It should briefly describe the change and end with (@yourname, #issuenumber).

@Javdat Javdat force-pushed the bugfix/unkown_status branch from 9af70f8 to 422b024 Compare April 11, 2019 14:38
@Javdat
Copy link
Contributor Author
Javdat commented Apr 11, 2019

Updated.

@hadley hadley merged commit 417411b into r-lib:master Apr 28, 2019
@hadley
Copy link
Member
hadley commented Apr 28, 2019

For future reference, if you include Fixes #xyz in a commit message (or the text of the PR), the corresponding issue will be automatically closed when the PR is merged.

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.

2 participants
0