Skip to content
Myr

Use content-type to parse Content-Type headers

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 69a4869 · Browse files · 3 files+16 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+16 added−6 removed

  • other:+16 added−6 removed

3 files+16 added−6 removed

modified:lib/utils.js+14 added-5 removed
1/*!2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2014-2015 Douglas Christopher Wilson5 * MIT Licensed6 */78/**9 * Module dependencies.10 * @api private11 */1213var contentType = require('content-type');14var etag = require('etag');15var mime = require('connect').mime;16var proxyaddr = require('proxy-addr');9var typer = require('media-typer');1718/**19 * toString ref.20 */
378 unmodified lines
399 * @return {String}400 * @api private401 */402396exports.setCharset = function(type, charset){397 if (!type || !charset) return type;403exports.setCharset = function setCharset(type, charset) {404 if (!type || !charset) {405 return type;406 }407408 // parse type400 var parsed = typer.parse(type);409 var parsed = contentType.parse(type);410411 // set charset412 parsed.parameters.charset = charset;413414 // format type406 return typer.format(parsed);415 return contentType.format(parsed);416};
modified:History.md+1 added
13.x2===34 * Use `content-type` to parse `Content-Type` headers5 * deps: connect@2.29.06 - Use `content-type` to parse `Content-Type` headers7 - deps: body-parser@~1.12.08 - deps: compression@~1.4.1
1980 unmodified lines
modified:package.json+1 added-1 removed