R/frost_stop_for_type.R

Defines functions frost_stop_for_type

# FROST STOP FOR TYPE ----
# Create a control function that throws an error if the response of the type
# is not of type JSON

frost_stop_for_type <- function(response) {
  if (httr::http_type(response) != "application/json") {
    stop("The API GET request did not return content as JSON", call. = FALSE)
  }
}

Try the frostr package in your browser

Any scripts or data that you put into this service are public.

frostr documentation built on Aug. 3, 2020, 5:08 p.m.