extensions/httpApi

Methods

(static) extendWorld(world)

Extends cucumber world object. Must be used inside customWorldConstructor.
Source:
Parameters:
Name Type Description
world Object The cucumber world object
Example
// /support/world.js

const { defineSupportCode } = require('cucumber')
const { state, httpApi } = require('@ekino/veggies')

defineSupportCode(({ setWorldConstructor }) => {
    setWorldConstructor(function() {
        state.extendWorld(this) // httpApi extension requires state extension
        httpApi.extendWorld(this)
    })
})

(static) install(config) → {function}

Installs the extension.
Source:
Parameters:
Name Type Description
config HttpApiConfig The `defineSupportCode` helper from cucumber
Returns:
Type:
function
The installation function
Example
// /support/world.js

const { defineSupportCode } = require('cucumber')
const { state, httpApi } = require('@ekino/veggies')

defineSupportCode(({ setWorldConstructor }) => {
    setWorldConstructor(function() {
        state.extendWorld(this) // httpApi extension requires state extension
        httpApi.extendWorld(this)
    })
})

state.install(defineSupportCode)
httpApi.install({
    baseUrl: 'http://localhost:3000',
})(defineSupportCode)

Type Definitions

HttpApiConfig

The http API configuration object.
Properties:
Name Type Attributes Default Description
baseUrl string <optional>
'' The base url used for all http calls
Source:
Type:
  • Object