Comparing version 2.4.0 to 2.5.0
@@ -9,4 +9,4 @@ module.exports = acceptMiddleware | ||
// If no 'Accept: x' header then bye | ||
if (!req.headers.accept) return res.sendStatus(406) | ||
// If no 'Accept: x' header assume anything is allowed | ||
if (!req.headers.accept) req.headers.accept = '*/*' | ||
@@ -13,0 +13,0 @@ // Get the list of acceptable response types |
@@ -5,3 +5,3 @@ { | ||
"description": "A pluggable JSON API server", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"tags": [], | ||
@@ -8,0 +8,0 @@ "license": "ISC", |
@@ -17,6 +17,6 @@ var request = require('supertest') | ||
it('should send a 406 response to a request with no "Accept"', function (done) { | ||
it('should assume a `*/*` "Accept" header to a request with no "Accept"', function (done) { | ||
request(app) | ||
.get('/') | ||
.expect(406, done) | ||
.expect(200, done) | ||
}) | ||
@@ -23,0 +23,0 @@ |
@@ -6,8 +6,7 @@ var assert = require('assert') | ||
it('should send a 406 response to a request with no "Accept"', function (done) { | ||
it('should assume */* "Accept" header to a request with no "Accept"', function (done) { | ||
function mockStatus(statusCode) { | ||
assert.equal(406, statusCode) | ||
done() | ||
assert.equal(200, statusCode) | ||
} | ||
middleware({ headers: {} }, { sendStatus: mockStatus }) | ||
middleware({ headers: {} }, { sendStatus: mockStatus }, done) | ||
}) | ||
@@ -14,0 +13,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
84748
29
2351
1