mirror of
https://github.com/zebrajr/express.git
synced 2026-01-15 12:15:27 +00:00
Use content-type to parse Content-Type headers
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
3.x
|
||||
===
|
||||
|
||||
* Use `content-type` to parse `Content-Type` headers
|
||||
* deps: connect@2.29.0
|
||||
- Use `content-type` to parse `Content-Type` headers
|
||||
- deps: body-parser@~1.12.0
|
||||
|
||||
19
lib/utils.js
19
lib/utils.js
@@ -1,12 +1,19 @@
|
||||
/*!
|
||||
* express
|
||||
* Copyright(c) 2009-2013 TJ Holowaychuk
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var contentType = require('content-type');
|
||||
var etag = require('etag');
|
||||
var mime = require('connect').mime;
|
||||
var proxyaddr = require('proxy-addr');
|
||||
var typer = require('media-typer');
|
||||
|
||||
/**
|
||||
* toString ref.
|
||||
@@ -393,15 +400,17 @@ exports.compileTrust = function(val) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.setCharset = function(type, charset){
|
||||
if (!type || !charset) return type;
|
||||
exports.setCharset = function setCharset(type, charset) {
|
||||
if (!type || !charset) {
|
||||
return type;
|
||||
}
|
||||
|
||||
// parse type
|
||||
var parsed = typer.parse(type);
|
||||
var parsed = contentType.parse(type);
|
||||
|
||||
// set charset
|
||||
parsed.parameters.charset = charset;
|
||||
|
||||
// format type
|
||||
return typer.format(parsed);
|
||||
return contentType.format(parsed);
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"basic-auth": "1.0.0",
|
||||
"connect": "2.29.0",
|
||||
"content-disposition": "0.5.0",
|
||||
"content-type": "~1.0.1",
|
||||
"commander": "2.6.0",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "~2.1.1",
|
||||
@@ -36,7 +37,6 @@
|
||||
"escape-html": "1.0.1",
|
||||
"etag": "~1.5.1",
|
||||
"fresh": "0.2.4",
|
||||
"media-typer": "0.3.0",
|
||||
"methods": "~1.1.1",
|
||||
"mkdirp": "0.5.0",
|
||||
"parseurl": "~1.3.0",
|
||||
|
||||
Reference in New Issue
Block a user