Interface MockerOption

Hierarchy

  • MockerOption

Properties

bodyParserConf?: {
    [key: string]: "raw" | "text" | "urlencoded" | "json";
}

bodyParser settings.

Example

bodyParser = {"text/plain": "text","text/html": "text"}

will parsed Content-Type='text/plain' and Content-Type='text/html' with bodyParser.text

Default

{}

Type declaration

  • [key: string]: "raw" | "text" | "urlencoded" | "json"
bodyParserJSON?: OptionsJson

bodyParserJSON JSON body parser

Default

{}

bodyParserRaw?: Options

bodyParserRaw Raw body parser

Default

{}

bodyParserText?: OptionsText

bodyParserText Text body parser

Default

{}

bodyParserUrlencoded?: OptionsUrlencoded

bodyParserUrlencoded URL-encoded form body parser

Default

{}

changeHost?: boolean

Boolean Setting req headers host.

header?: Record<string, string | number | string[]>

Access Control Allow options.

Default

{}

Example

{
header: {
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE',
}
}
httpProxy?: {
    listeners?: HttpProxyListeners;
    options?: ServerOptions;
}

Set the listen event and configuration of http-proxy

Default

{}

Type declaration

pathRewrite?: Record<string, string>

rewrite target's url path. Object-keys will be used as RegExp to match paths. #62

Default

{}

priority?: "mocker" | "proxy"

priority 'proxy' or 'mocker'

Default

proxy

Issue

#151

proxy?: Record<string, string>

Proxy settings, Turn a path string such as /user/:name into a regular expression. path-to-regexp

Default

{}

watchOptions?: WatchOptions

Options object as defined chokidar api options

Default

{}

withFullUrlPath?: boolean

Boolean the proxy regular expression support full url path. if the proxy regular expression like /test?a=1&b=1 can be matched

Generated using TypeDoc