How to
Write your own plugin
Plugin is just a plain object with specific keys.
Plugin interface (all entries are optional):
shouldExecute(context)
- boolean function indicating is plugin should execute at current phaseinit(context, next, makeRequest?)
- this function will be called atinit
phasecomplete(context, next, makeRequest?)
- this function will be called atcomplete
phaseerror(context, next, makeRequest?)
- this function will be called aterror
phase
context
- the current request execution context, an object with specific methods to change request state (request data, response, error, meta data)
next
- callback function which should be called after plugin did its job.
makeRequest
- function to make request (it will be executed with current settings)