Creates a new HAR attached to the proxy and returns the HAR content if there was a previous HAR.

createHAR(proxy, ref = NULL, title = ref, captureHeaders = FALSE,
  captureContent = FALSE, captureBinaryContent = FALSE,
  captureCookies = FALSE, ...)

Arguments

proxy
An object of class "proxy". A proxy object see proxy.
ref
The string name of The first page ref that should be used in the HAR. Optional if NULL defaults to "Page 1".
title
The title of first HAR page. Optional, default to ref
captureHeaders
Boolean, capture headers or not. Optional, default to FALSE.
captureContent
Boolean, capture content bodies or not. Optional, default to FALSE.
captureBinaryContent
Boolean, capture binary content or not. Optional, default to FALSE.
captureCookies
Boolean, capture cookies or not. Optional, default to FALSE.
...
Additonal function arguments

Value

Returns a list with the response status code and har content. Returns status 204 when creating a har with a particular name the first time and har = NULL. Returns 200 and the previous har when creating one with the same name

See also

Other har functions: getHAR, newPage

Examples

## Not run: ------------------------------------ # # A BMP server is assummed running on port 9090 # prxy <- proxy(bmpPort = 9090L, port = 39500L) # library(httr) # prxy %>% createHAR(ref = "httr_traffic_1") # # use httr_proxy to configure proxy for httr # rproj <- GET("https://www.r-project.org/", httr_proxy(prxy)) # httr_har <- prxy %>% getHAR() # httr_har[["log"]][["entries"]][[1]]["request"] # httr_har[["log"]][["entries"]][[1]]["response"] # # # set new page # prxy %>% newPage(ref = "httr_traffic_2") # rcran <- GET("https://cran.r-project.org/", httr_proxy(prxy)) # httr_har <- prxy %>% getHAR() # vapply(httr_har[["log"]][["pages"]], '[[', character(1), "id") # # [1] "httr_traffic_1" "httr_traffic_2" # prxy %>% closeProxy ## ---------------------------------------------