TestPlugin: Testing Plugin

Description Super classes Methods

Description

Provide a set of utilities to test requests going through the application logic, for profiling or evaluation.

Super classes

webtools::Configurable -> webtools::Plugin -> webtools::DispatchPlugin -> Plugin

Methods

Public methods

Inherited methods

Method new()

Create a new TestPlugin

Usage
TestPlugin$new()

Method header()

Simulate an HTTP header request

Usage
TestPlugin$header(
  path = "/",
  url = NULL,
  method = "get",
  router = NULL,
  base_path = "",
  content = "",
  headers = list(),
  trust = TRUE,
  ...
)
Arguments
path

(str) path to be hit by the request

url

(str) URL of the request

method

(str) HTTP method

router

(str) route name

base_path

(str) root; stripped out of the path when handling requests

content

(str) content of the request

headers

(lst) list of request headers of the test request

trust

(flg) indicates whether request should be trusted

...

(arg) additional arguments to fiery::fake_request()


Method request()

Simulate an HTTP request

Usage
TestPlugin$request(
  path = "/",
  url = NULL,
  method = "get",
  router = NULL,
  base_path = "",
  content = "",
  headers = list(),
  trust = TRUE,
  ...
)
Arguments
path

(str) path to be hit by the request

url

(str) URL of the request

method

(str) HTTP method

router

(str) route name

base_path

(str) root; stripped out of the path when handling requests

content

(str) content of the request

headers

(lst) list of request headers of the test request

trust

(flg) indicates whether request should be trusted

...

(arg) additional arguments to fiery::fake_request()


Method message()

Simulate a websocket message

Usage
TestPlugin$message(
  message,
  ...,
  binary = FALSE,
  path = "/",
  url = NULL,
  method = "get",
  router = NULL,
  base_path = "",
  content = "",
  headers = list(),
  trust = TRUE,
  close = TRUE
)
Arguments
message

(str) message to be sent

...

(arg) extra arguments

binary

(flg) is the message a binary message?

path

(str) path to be hit by the request

url

(str) URL of the request

method

(str) HTTP method

router

(str) route name

base_path

(str) root; stripped out of the path when handling requests

content

(str) content of the request

headers

(lst) list of request headers of the test request

trust

(flg) indicates whether request should be trusted

close

(flg) if this is not a route, then close the connection?


tjpalanca/webtools documentation built on Dec. 23, 2021, 11 a.m.