jsonapi-server
Advanced tools
Comparing version 1.15.1 to 1.15.2
@@ -0,1 +1,3 @@ | ||
- 2016-07-06 - v1.15.2 | ||
- 2016-07-06 - CORS headers are now applier further up the middleware chain | ||
- 2016-07-05 - v1.15.1 | ||
@@ -2,0 +4,0 @@ - 2016-07-05 - Fixed bug when deleting singular relationships via deep urls |
@@ -23,2 +23,19 @@ /* @flow weak */ | ||
app.use(function(req, res, next) { | ||
res.set({ | ||
"Content-Type": "application/vnd.api+json", | ||
"Access-Control-Allow-Origin": "*", | ||
"Access-Control-Allow-Methods": "GET, POST, PATCH, DELETE, OPTIONS", | ||
"Access-Control-Allow-Headers": req.headers["access-control-request-headers"] || "", | ||
"Cache-Control": "private, must-revalidate, max-age=0", | ||
"Expires": "Thu, 01 Jan 1970 00:00:00" | ||
}); | ||
if (req.method === "OPTIONS") { | ||
return res.status(204).end(); | ||
} | ||
return next(); | ||
}); | ||
app.use(function(req, res, next) { | ||
if (!req.headers["content-type"] && !req.headers.accept) return next(); | ||
@@ -55,19 +72,2 @@ | ||
app.use(function(req, res, next) { | ||
res.set({ | ||
"Content-Type": "application/vnd.api+json", | ||
"Access-Control-Allow-Origin": "*", | ||
"Access-Control-Allow-Methods": "GET, POST, PATCH, DELETE, OPTIONS", | ||
"Access-Control-Allow-Headers": req.headers["access-control-request-headers"] || "", | ||
"Cache-Control": "private, must-revalidate, max-age=0", | ||
"Expires": "Thu, 01 Jan 1970 00:00:00" | ||
}); | ||
if (req.method === "OPTIONS") { | ||
return res.status(204).end(); | ||
} | ||
return next(); | ||
}); | ||
app.use(bodyParser.json()); | ||
@@ -74,0 +74,0 @@ app.use(bodyParser.urlencoded({ extended: true })); |
{ | ||
"name": "jsonapi-server", | ||
"version": "1.15.1", | ||
"version": "1.15.2", | ||
"description": "A config driven NodeJS framework implementing json:api", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
243950