Skip to content

Execute code with configuration set.

Usage

with_config(config = config(), expr, override = FALSE)

with_verbose(expr, ...)

Arguments

config

Settings as generated by add_headers(), set_cookies() or authenticate().

expr

code to execute under specified configuration

override

if TRUE, ignore existing settings, if FALSE, combine new config with old.

...

Other arguments passed on to verbose()

See also

Other ways to set configuration: config(), set_config()

Examples

with_config(verbose(), {
  GET("http://had.co.nz")
  GET("http://google.com")
})
#> Response [http://www.google.com/]
#>   Date: 2023-08-15 18:20
#>   Status: 200
#>   Content-Type: text/html; charset=ISO-8859-1
#>   Size: 18.3 kB
#> <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" ...
#> var h=this||self;function l(){return void 0!==window.google&&void 0!==w...
#> function t(a,b,c,d,k){var e="";-1===b.search("&ei=")&&(e="&ei="+p(d),-1...
#> document.documentElement.addEventListener("submit",function(b){var a;if...
#> </style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:...
#> var l=this||self;var m,n=null!=(m=l.mei)?m:1,p,q=null!=(p=l.sdo)?p:!0,r...
#> a.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&...
#> 0;k<g.length;k++)-1!==g[k].name.indexOf(google.xjsu)&&(h=1),-1!==g[k].n...
#> if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbq...
#> }
#> ...

# Or even easier:
with_verbose(GET("http://google.com"))
#> Response [http://www.google.com/]
#>   Date: 2023-08-15 18:20
#>   Status: 200
#>   Content-Type: text/html; charset=ISO-8859-1
#>   Size: 18.3 kB
#> <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" ...
#> var h=this||self;function l(){return void 0!==window.google&&void 0!==w...
#> function t(a,b,c,d,k){var e="";-1===b.search("&ei=")&&(e="&ei="+p(d),-1...
#> document.documentElement.addEventListener("submit",function(b){var a;if...
#> </style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:...
#> var l=this||self;var m,n=null!=(m=l.mei)?m:1,p,q=null!=(p=l.sdo)?p:!0,r...
#> a.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&...
#> 0;k<g.length;k++)-1!==g[k].name.indexOf(google.xjsu)&&(h=1),-1!==g[k].n...
#> if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbq...
#> }
#> ...