Skip to content

Commit

Permalink
Change the default failure in parse_http_date() to NA with class Date (
Browse files Browse the repository at this point in the history
…#544)

Otherwise, print.response() may throw an unfriendly error.
  • Loading branch information
shrektan authored and hadley committed Nov 22, 2018
1 parent 2564b85 commit 5345aaf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# httr 1.3.1.9000

* The default value of `failure` argument in `parse_http_date()` is set to `structure(NA_real_, class = "Date")` so that the reponse with a "failure" date can be printed out correctly. (@shrektan, #544)

# httr 1.3.1

* Re-enable on-disk caching (accidentally disabled in #457) (#475)
Expand Down
2 changes: 1 addition & 1 deletion R/date.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' parse_http_date("Sun Nov 6 08:49:37 1994")
#'
#' http_date(Sys.time())
parse_http_date <- function(x, failure = NA) {
parse_http_date <- function(x, failure = structure(NA_real_, class = "Date")) {
if (length(x) == 0) return(NULL)

fmts <- c(
Expand Down
2 changes: 1 addition & 1 deletion man/parse_http_date.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5345aaf

Please sign in to comment.