newPage: Create new page

Description Usage Arguments Value See Also Examples

Description

Starts a new page on the existing HAR.

Usage

1
newPage(proxy, ref = NULL, title = ref, ...)

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, default to "Page N" where N is the next page number (zero indexed so 1st page is page 0).

title

The title of new HAR page. Optional, default to ref.

...

Additonal function arguments

Value

invisible(proxy): An object of class "proxy" is invisibly returned. A proxy object see proxy. This allows for chaining from this function to other functions that take such an object as an argument. See examples for further details.

See Also

Other har functions: createHAR, getHAR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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

## End(Not run)

johndharrison/bmproxy documentation built on May 19, 2019, 5:13 p.m.