JSON API Headers
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; // OR With extension support.app;
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
.