Add express.text to parse bodies into string

closes #3455
This commit is contained in:
Ilya Guterman
2017-10-23 18:00:19 +03:00
committed by Douglas Christopher Wilson
parent 11192bd168
commit 7f4e37f3ea
3 changed files with 7 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ unreleased
==========
* Add `express.raw` to parse bodies into `Buffer`
* Add `express.text` to parse bodies into string
* Improve error message for non-strings to `res.sendFile`
* Improve error message for `null`/`undefined` to `res.status`
* Support multiple hosts in `X-Forwarded-Host`

View File

@@ -79,6 +79,7 @@ exports.json = bodyParser.json
exports.query = require('./middleware/query');
exports.raw = bodyParser.raw
exports.static = require('serve-static');
exports.text = bodyParser.text
exports.urlencoded = bodyParser.urlencoded
/**

View File

@@ -24,6 +24,11 @@ describe('exports', function(){
assert.equal(express.static.length, 2)
})
it('should expose text middleware', function () {
assert.equal(typeof express.text, 'function')
assert.equal(express.text.length, 1)
})
it('should expose urlencoded middleware', function () {
assert.equal(typeof express.urlencoded, 'function')
assert.equal(express.urlencoded.length, 1)