From 88c46b30f7c1d05e4e250061227b1545f374eb98 Mon Sep 17 00:00:00 2001 From: trestletech Date: Mon, 4 Dec 2017 09:24:05 -0600 Subject: [PATCH] Revert "cookie expires and max-age arguments format (#215)" I needed to merge the 0.4.4 changes before merging this to have a stable tag. Will un-revert momentarily. This reverts commit 3313bed7c18ba5a53dca10995fa7f52a1500b455. --- R/response.R | 8 ++++---- tests/testthat/test-cookies.R | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/response.R b/R/response.R index 4b5259fec..6d000423f 100644 --- a/R/response.R +++ b/R/response.R @@ -65,14 +65,14 @@ cookieToStr <- function(name, value, path, expiration=FALSE, http=FALSE, secure= expy <- now + expiration expyStr <- format(expy, format="%a, %e %b %Y %T", tz="GMT", usetz=TRUE) - str <- paste0(str, "Expires= ", expyStr, "; ") - str <- paste0(str, "Max-Age= ", expiration, "; ") + str <- paste0(str, "Expires: ", expyStr, "; ") + str <- paste0(str, "Max-Age: ", expiration, "; ") } else if (inherits(expiration, "POSIXt")){ seconds <- difftime(expiration, Sys.time(), units="secs") # TODO: DRY expyStr <- format(expiration, format="%a, %e %b %Y %T", tz="GMT", usetz=TRUE) - str <- paste0(str, "Expires= ", expyStr, "; ") - str <- paste0(str, "Max-Age= ", as.integer(seconds), "; ") + str <- paste0(str, "Expires: ", expyStr, "; ") + str <- paste0(str, "Max-Age: ", as.integer(seconds), "; ") } # interpret all other values as session cookies. } diff --git a/tests/testthat/test-cookies.R b/tests/testthat/test-cookies.R index 1330060b8..3a5b850dd 100644 --- a/tests/testthat/test-cookies.R +++ b/tests/testthat/test-cookies.R @@ -43,11 +43,11 @@ test_that("cookies can convert to string", { # line above and below. # When given as a number of seconds expect_equal(cookieToStr("abc", 123, expiration=expiresSec), - paste0("abc=123; Expires= ", expyStr, "; Max-Age= ", expiresSec)) + paste0("abc=123; Expires: ", expyStr, "; Max-Age: ", expiresSec)) # When given as a POSIXct # difftime is exclusive, so the Max-Age may be off by one on positive time diffs. expect_equal(cookieToStr("abc", 123, expiration=expires), - paste0("abc=123; Expires= ", expyStr, "; Max-Age= ", expiresSec-1)) + paste0("abc=123; Expires: ", expyStr, "; Max-Age: ", expiresSec-1)) # Works with a negative number of seconds expiresSec <- -10 @@ -57,10 +57,10 @@ test_that("cookies can convert to string", { # line above and below. # When given as a number of seconds expect_equal(cookieToStr("abc", 123, expiration=expiresSec), - paste0("abc=123; Expires= ", expyStr, "; Max-Age= ", expiresSec)) + paste0("abc=123; Expires: ", expyStr, "; Max-Age: ", expiresSec)) # When given as a POSIXct expect_equal(cookieToStr("abc", 123, expiration=expires), - paste0("abc=123; Expires= ", expyStr, "; Max-Age= ", expiresSec)) + paste0("abc=123; Expires: ", expyStr, "; Max-Age: ", expiresSec)) })