Sha256: 07e3df5901428f23efc5084a21f17ff8c75c526d8705155b0a514c163a5d9828

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

/*!
 * Connect - urlencoded
 * Copyright(c) 2010 Sencha Inc.
 * Copyright(c) 2011 TJ Holowaychuk
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var bodyParser = require('body-parser');
var deprecate = require('depd')('connect');
var utils = require('../utils');

/**
 * Urlencoded:
 *
 * See [body-parser](https://github.com/expressjs/body-parser)
 *
 * @param {Object} options
 * @return {Function}
 * @api public
 */

module.exports = function urlencoded(options) {
  var opts = utils.merge({
    extended: true,
    limit: '1mb'
  }, options);

  // back-compat verify function
  if (typeof opts.verify === 'function') {
    deprecate('urlencoded.verify: use body-parser module for verify');
    opts.verify = convertVerify(opts.verify);
  }

  return bodyParser.urlencoded(opts);
};

/**
 * Convert old verify signature to body-parser version.
 *
 * @param {Function} verify
 * @return {Function}
 * @api private
 */

function convertVerify(verify) {
  return function (req, res, buf, encoding) {
    verify(req, res, buf.toString(encoding));
  };
}

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/lib/middleware/urlencoded.js