File: real_connections.R

package info (click to toggle)
r-cran-vcr 0.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,360 kB
  • sloc: cpp: 15; sh: 13; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
#' Are real http connections allowed?
#'
#' @export
#' @return boolean, `TRUE` if real HTTP requests allowed; `FALSE` if not
#' @examples
#' real_http_connections_allowed()
real_http_connections_allowed <- function() {
  trycurr <- tryCatch(current_cassette(), error = function(e) e)
  if (!inherits(trycurr, c("error", "list")))
    return(current_cassette()$recording())
  if (identical(trycurr, list())) return(FALSE)
  !(vcr_c$allow_http_connections_when_no_cassette || !turned_on())
}