qookiemonster
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

qookiemonster

CI Maintainability Test Coverage

Stateless fake API based on cookie processing

Usage

On server side:

//...
import {cookiemonster} from '@qiwi/cookiemonster'

const app = express()

app.use(cookieParser())
app.use(bodyParser.json())
app.use(cookiemonster())

app.listen(8080)

On client:

import {formatScenario} from '@qiwi/cookiemonster'

const data = formatScenario({
  steps: [
    {res: {code: 200, body: {foo: 'bar'}}}
  ]
})

document.cookie = `Cookiemonster=${data}`

const result = await fetch('http://localhost:8080', {credentials: 'include'})
const json = await result.json() // {foo: 'bar'}

Refs

License

MIT

Package Sidebar

Install

npm i qookiemonster

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

13.9 kB

Total Files

8

Last publish

Collaborators

  • qiwibot