2.0.0 • Published 7 years ago

jsonapi-headers v2.0.0

Weekly downloads
99
License
MIT
Repository
github
Last release
7 years ago

JSON API Headers

Build Status Coverage Status

This module validates incoming headers and adds outgoing headers for JSON API based systems. In additon to basic content negotiation this module supports extension negotiation.

Usage

// Without extension support.
app.use(require('jsonapi-headers')());

// OR With extension support.
app.use(require('jsonapi-headers')(['batch', 'jsonpatch']));

The resulting middleware will validate Accept and Content-Type headers as defined by JSON API and will call next with an error if the headers are invalid (either a 406 or 415 depending on what's wrong).

If there are no validation problems, the Content-Type of the response will be appropriately assigned, e.g. application/vnd.api+json; ext=bulk; supported-ext="batch,jsonpatch"

Additionally, any extensions that the request is supporting will be added as an array to req.ext.

2.0.0

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago