Changements dans les modules (nouvelle version Express, mysql, ..)
This commit is contained in:
29
node_modules/accepts/index.js
generated
vendored
29
node_modules/accepts/index.js
generated
vendored
@@ -29,10 +29,9 @@ module.exports = Accepts
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts (req) {
|
||||
if (!(this instanceof Accepts)) {
|
||||
function Accepts(req) {
|
||||
if (!(this instanceof Accepts))
|
||||
return new Accepts(req)
|
||||
}
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
@@ -96,18 +95,12 @@ Accepts.prototype.types = function (types_) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
// no accept header, return first given type
|
||||
if (!this.headers.accept) {
|
||||
return types[0]
|
||||
}
|
||||
|
||||
var mimes = types.map(extToMime)
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||
var first = accepts[0]
|
||||
|
||||
return first
|
||||
? types[mimes.indexOf(first)]
|
||||
: false
|
||||
if (!this.headers.accept) return types[0];
|
||||
var mimes = types.map(extToMime);
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime));
|
||||
var first = accepts[0];
|
||||
if (!first) return false;
|
||||
return types[mimes.indexOf(first)];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +212,7 @@ Accepts.prototype.languages = function (languages_) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime (type) {
|
||||
function extToMime(type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
@@ -233,6 +226,6 @@ function extToMime (type) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime (type) {
|
||||
return typeof type === 'string'
|
||||
function validMime(type) {
|
||||
return typeof type === 'string';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user