diff options
author | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:37:53 -0500 |
---|---|---|
committer | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:40:37 -0500 |
commit | 324ee36fe31763e507b422ab0a88e4230045e205 (patch) | |
tree | d0b04520f6657601c918ce63fd27575977624187 /dgbuilder/dgeflows/node_modules/express/lib/middleware | |
parent | f0c97e8db427481e28c0a16b789bc73801b35e47 (diff) |
Initial commit for OpenECOMP SDN-C OA&M
Change-Id: I7ab579fd0d206bf356f36d52dcdf4f71f1fa2680
Signed-off-by: Timoney, Daniel (dt5972) <dtimoney@att.com>
Former-commit-id: 2a9f0edd09581f907e62ec4689b5ac94dd5382ba
Diffstat (limited to 'dgbuilder/dgeflows/node_modules/express/lib/middleware')
-rw-r--r-- | dgbuilder/dgeflows/node_modules/express/lib/middleware/init.js | 26 | ||||
-rw-r--r-- | dgbuilder/dgeflows/node_modules/express/lib/middleware/query.js | 30 |
2 files changed, 56 insertions, 0 deletions
diff --git a/dgbuilder/dgeflows/node_modules/express/lib/middleware/init.js b/dgbuilder/dgeflows/node_modules/express/lib/middleware/init.js new file mode 100644 index 00000000..1e3e903f --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/express/lib/middleware/init.js @@ -0,0 +1,26 @@ +/** + * Initialization middleware, exposing the + * request and response to each other, as well + * as defaulting the X-Powered-By header field. + * + * @param {Function} app + * @return {Function} + * @api private + */ + +exports.init = function(app){ + return function expressInit(req, res, next){ + if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); + req.res = res; + res.req = req; + req.next = next; + + req.__proto__ = app.request; + res.__proto__ = app.response; + + res.locals = res.locals || Object.create(null); + + next(); + }; +}; + diff --git a/dgbuilder/dgeflows/node_modules/express/lib/middleware/query.js b/dgbuilder/dgeflows/node_modules/express/lib/middleware/query.js new file mode 100644 index 00000000..092bbd99 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/express/lib/middleware/query.js @@ -0,0 +1,30 @@ +/** + * Module dependencies. + */ + +var parseUrl = require('parseurl'); +var qs = require('qs'); + +/** + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function query(options) { + var queryparse = qs.parse; + + if (typeof options === 'function') { + queryparse = options; + options = undefined; + } + + return function query(req, res, next){ + if (!req.query) { + var val = parseUrl(req).query; + req.query = queryparse(val, options); + } + + next(); + }; +}; |