Skip to content

Commit

Permalink
Add express.raw to parse bodies into Buffer
Browse files Browse the repository at this point in the history
closes #3708
  • Loading branch information
amitzur authored and dougwilson committed May 8, 2019
1 parent 60aacac commit 0bcdd88
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
@@ -1,6 +1,7 @@
unreleased
==========

* Add `express.raw` to parse bodies into `Buffer`
* 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 @@ -77,6 +77,7 @@ exports.Router = Router;

exports.json = bodyParser.json
exports.query = require('./middleware/query');
exports.raw = bodyParser.raw
exports.static = require('serve-static');
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 @@ -14,6 +14,11 @@ describe('exports', function(){
assert.equal(express.json.length, 1)
})

it('should expose raw middleware', function () {
assert.equal(typeof express.raw, 'function')
assert.equal(express.raw.length, 1)
})

it('should expose static middleware', function () {
assert.equal(typeof express.static, 'function')
assert.equal(express.static.length, 2)
Expand Down

0 comments on commit 0bcdd88

Please sign in to comment.