R/check_for_200.R

Defines functions check_for_200

Documented in check_for_200

#' Check for error messages on non-200 responses
#'
#' @param response A response from a POST call to one of the oliver Sign-in Domains.
#'
#' @return
#' @export
#'
#' @examples
check_for_200 <- function(response) {
  
  if (httr::status_code(response) != 200) {
    stop(
      sprintf(
        "API request failed [%s]"
        ,httr::status_code(response)
      ),
      call. = FALSE
    )
  }
}
joemienko/mycorrhiza documentation built on Feb. 3, 2020, 12:05 a.m.