Skip to content

Commit 7f4e37f

Browse files
amferndougwilson
authored andcommitted
Add express.text to parse bodies into string
closes #3455
1 parent 11192bd commit 7f4e37f

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

History.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ unreleased
22
==========
33

44
* Add `express.raw` to parse bodies into `Buffer`
5+
* Add `express.text` to parse bodies into string
56
* Improve error message for non-strings to `res.sendFile`
67
* Improve error message for `null`/`undefined` to `res.status`
78
* Support multiple hosts in `X-Forwarded-Host`

lib/express.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ exports.json = bodyParser.json
7979
exports.query = require('./middleware/query');
8080
exports.raw = bodyParser.raw
8181
exports.static = require('serve-static');
82+
exports.text = bodyParser.text
8283
exports.urlencoded = bodyParser.urlencoded
8384

8485
/**

test/exports.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ describe('exports', function(){
2424
assert.equal(express.static.length, 2)
2525
})
2626

27+
it('should expose text middleware', function () {
28+
assert.equal(typeof express.text, 'function')
29+
assert.equal(express.text.length, 1)
30+
})
31+
2732
it('should expose urlencoded middleware', function () {
2833
assert.equal(typeof express.urlencoded, 'function')
2934
assert.equal(express.urlencoded.length, 1)

0 commit comments

Comments
 (0)