API Docs for: HEAD
Show:

RoboHydra Class

Dispatches the incoming requests. Normally there is only one of this per server, but there can be several if summoners are used.

Constructor

RoboHydra

(
  • extraVars
)

Parameters:

  • extraVars Object

    An optional object with the extra configuration variables. These take precedence over any other configuration variables elsewhere, and are the values passed as command-line parameters in the "robohydra" executable.

Methods

attachHead

(
  • pluginName
  • headName
)

Attach the given head.

Parameters:

  • pluginName String

    The name of the plugin containing the head to (re-)attach.

  • headName String

    The name of the head to (re-)attach.

detachHead

(
  • pluginName
  • headName
)

Detach the given head.

Parameters:

  • pluginName String

    The name of the plugin containing the head to detach.

  • headName String

    The name of the head to detach.

getModulesObject

(
  • conf
)
Object

Returns an object with the modules for a given plugin.

Parameters:

  • conf Object

    The full, resolved configuration for the plugin the module object is for.

Returns:

Object:

Object with the names of the available modules as keys, and objects with functions as values.

getPlugin

(
  • pluginName
)
Object

Returns a plugin given its name.

Parameters:

  • pluginName String

    The name of the plugin

Returns:

Object:

The plugin with the given name

getPluginNames

() Array

Returns the names of the current plugins, including pseudo-plugins.

Returns:

Array:

An array with the names of the plugins in the hydra.

getPlugins

() Array

Returns a list of all current plugins, including pseudo-plugins.

Returns:

Array:

An array containing all plugins in the hydra.

headForPath

(
  • req
  • afterHead
)
RoboHydraHead

Returns the first head that matches a given URL.

Parameters:

  • req Request

    Request object the head must match

  • afterHead RoboHydraHead

    If given, only heads after the given one will be considered for matching.

Returns:

RoboHydraHead:

First head matching the given URL.

registerDynamicHead

(
  • head
  • opts
)

Adds a new (dynamic) head into a hydra. The new head is added at the beginning of the appropriate pseudo-plugin ("admin-dynamic", "priority-dynamic", or "dynamic", if the priority given is "admin", "high", or "normal"). The order of the plugins is: "admin-dynamic", special admin plugin (which is normally not visible in the admin interface!), "priority-dynamic", "dynamic", "current-scenario", and regular plugins.

Parameters:

  • head RoboHydraHead

    The head to add

  • opts Object

    Options

    • priority String

      The priority of the head. Can be "normal", "high", or "admin".

registerPluginObject

(
  • pluginObject
)

Register the given plugin object at the end of the hydra.

Parameters:

  • pluginObject Object
    • name String

      The name of the plugin. Must be exclusively comprised of ASCII letters, numbers, underscores and dashes. Mandatory.

    • path String

      The path to the plugin directory. Mandatory.

    • config Object

      An object with the plugin-specific configuration. Optional.

    • module Object

      The plugin module itself (ie. an object with the "getBodyParts" function).

startScenario

(
  • pluginName
  • scenarioName
)

Start the given scenario.

Parameters:

  • pluginName String

    The name of the plugin containing the scenario to start.

  • scenarioName String

    The name of the scenario to start.

stopScenario

(
  • pluginName
  • scenarioName
)

Stop the given scenario.

Parameters:

  • pluginName String

    The name of the plugin containing the scenario to stop.

  • scenarioName String

    The name of the scenario to stop.

Properties

currentScenario

Object

The currently active scenario, if any. It's an object with the keys "plugin" and "scenario". If there’s no active scenario, it’s "*default*" / "*default*".

scenarioResults

Object deprecated

Deprecated alias for testResults, please use testResults instead.

testResults

Object

Current test (assertion) results. Its keys are plugin names and its values are objects with scenario names as keys. The values of the latter objects are test results: objects with the keys "result" (value is undefined if the test doesn’t have any result yet, or the strings "pass" or "fail" if at least one assertion has run for that test), "passes" (an array with the description of the passing assertions) and "failures" (ditto for failing assertions). Assertion results obtained outside of a scenario are stored under the plugin name "*default*" and the scenario name "*default*".