Skip to content

Commit

Permalink
Add express.text to parse bodies into string
Browse files Browse the repository at this point in the history
closes #3455
  • Loading branch information
amfern authored and dougwilson committed May 9, 2019
1 parent 11192bd commit 7f4e37f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
5 changes: 5 additions & 0 deletions test/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7f4e37f

Please sign in to comment.