Tammy // mock
Note: mock for tammy or axios
Installation
tammy
via classical <script>
tag
Load
const mock = ;mock;tammyhttpdefaultsadapter = mock; ;
CommonJS style with npm
npm install tammy --save # mock npm install tammy-mock --save
// es6;; const mock = ;mock;httpdefaultsadapter = mock; ;
API
- use(fn)
- all(path, ...fns)
- head(path, ...fns)
- options(path, ...fns)
- get(path, ...fns)
- put(path, ...fns)
- patch(path, ...fns)
- post(path, ...fns)
- delete(path, ...fns)
- del(path, ...fns)
req
- url
- method
- path
- headers
- query
- body
- xhr
- header(name)
- getHeader(name)
- get(name)
res
- req
- headers
- type(type)
- header(name, value)
- set(name, value)
- setHeader(name, value)
- get(name)
- getHeader(name)
- removeHeader(name)
- status(code)
- send(body)
- json(obj)