Skip to content
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

Remove the Date header as httpuv does this automatically now #380

Merged
merged 5 commits into from
Feb 7, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions R/response.R
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
#' HTTP Date String
#'
#' Given a POSIXct object, return a date string in the format required for a
#' HTTP Date header. For example: "Wed, 21 Oct 2015 07:28:00 GMT"
#'
#' @noRd
http_date_string <- function(time) {
weekday_names <- c("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
weekday_num <- as.integer(strftime(time, format = "%w", tz = "GMT")) + 1L
weekday_name <- weekday_names[weekday_num]

month_names <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
month_num <- as.integer(strftime(time, format = "%m", tz = "GMT"))
month_name <- month_names[month_num]

strftime(
time,
paste0(weekday_name, ", %d ", month_name, " %Y %H:%M:%S GMT"),
tz = "GMT"
)
}

PlumberResponse <- R6Class(
"PlumberResponse",
Expand All @@ -38,7 +16,6 @@ PlumberResponse <- R6Class(
},
toResponse = function(){
h <- self$headers
h$Date <- http_date_string(Sys.time())

body <- self$body
if (is.null(body)){
Expand Down