forked from expressjs/body-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.js
More file actions
36 lines (29 loc) · 669 Bytes
/
Copy pathtext.js
File metadata and controls
36 lines (29 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*!
* body-parser
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
*/
const debug = require('debug')('body-parser:text')
const read = require('../read')
const { normalizeOptions, passthrough } = require('../utils')
/**
* Module exports.
*/
module.exports = text
/**
* Create a middleware to parse text bodies.
*
* @param {Object} [options]
* @returns {Function}
* @public
*/
function text (options) {
const normalizedOptions = normalizeOptions(options, 'text/plain')
return function textParser (req, res, next) {
read(req, res, next, passthrough, debug, normalizedOptions)
}
}