Skip to content

Commit 0bcdd88

Browse files
amitzurdougwilson
authored andcommittedMay 8, 2019
Add express.raw to parse bodies into Buffer
closes #3708
1 parent 60aacac commit 0bcdd88

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed
 

‎History.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
unreleased
22
==========
33

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

‎lib/express.js

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ exports.Router = Router;
7777

7878
exports.json = bodyParser.json
7979
exports.query = require('./middleware/query');
80+
exports.raw = bodyParser.raw
8081
exports.static = require('serve-static');
8182
exports.urlencoded = bodyParser.urlencoded
8283

‎test/exports.js

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ describe('exports', function(){
1414
assert.equal(express.json.length, 1)
1515
})
1616

17+
it('should expose raw middleware', function () {
18+
assert.equal(typeof express.raw, 'function')
19+
assert.equal(express.raw.length, 1)
20+
})
21+
1722
it('should expose static middleware', function () {
1823
assert.equal(typeof express.static, 'function')
1924
assert.equal(express.static.length, 2)

0 commit comments

Comments
 (0)
Please sign in to comment.