Tools to Work with the 'Splash' JavaScript Rendering Service in R
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
685B

  1. #' Retrieve size of content | body | headers
  2. #'
  3. #' @param har_resp_obj HAR response object
  4. #' @family splash_har_helpers
  5. #' @export
  6. get_content_size <- function(har_resp_obj) {
  7. csize <- har_resp_obj$response$content$size
  8. if (is.null(csize)) return(NA_real_)
  9. return(as.numeric(csize))
  10. }
  11. #' @rdname get_content_size
  12. #' @export
  13. get_body_size <- function(har_resp_obj) {
  14. bsize <- har_resp_obj$response$bodySize
  15. if (is.null(bsize)) return(NA_real_)
  16. return(as.numeric(bsize))
  17. }
  18. #' @rdname get_content_size
  19. #' @export
  20. get_headers_size <- function(har_resp_obj) {
  21. hsize <- har_resp_obj$response$headersSize
  22. if (is.null(hsize)) return(NA_real_)
  23. return(as.numeric(hsize))
  24. }