koa-accepts
Adjust content type based on accepts header
Last updated 2 years ago by ratsupremacy .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koa-accepts 
SYNC missed versions from official npm registry.

koa-accepts

CircleCI

Simple middleware to change the format of your response based on the HTTP accept header, using q weights via the negotiator library.

Supported formats:

  • application/yaml: YAML
  • application/x-msgpack: MsgPack
  • application/json: JSON.stringify

If anything else it will fall back to doing what koa normally does (JSON).

Quickstart

import * as koa from 'koa'
import accepts from 'koa-accepts'

const app = new Koa()

app.use(accepts())

Current Tags

  • 0.7.0                                ...           latest (2 years ago)

16 Versions

  • 0.7.0                                ...           2 years ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (10)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |