# Specify an action to detect a cookie named "mycookie".
req_has_cookie("mycookie")
# Specify an action to detect the *lack* of a cookie named "mycookie".
req_has_cookie("mycookie", negate = TRUE)
# Specify an action to detect a cookie named "mycookie" that has 27
# characters.
req_has_cookie(
cookie_name = "mycookie",
validation_fn = function(cookie_value) {
nchar(cookie_value == 27)
}
)
# Specify an action to detect a cookie named "mycookie" that has N
# characters. This would make more sense in a case where validation_fn isn't
# an anonymous function.
req_has_cookie(
cookie_name = "mycookie",
validation_fn = function(cookie_value, N) {
nchar(cookie_value) == N
},
N = 27
)
Run the code above in your browser using DataLab