Skip to content

Commit

Permalink
include encoding in "unsupported content encoding" message
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Sep 24, 2014
1 parent 6330764 commit 360cf1b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 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
==========

* include the charset in "unsupported charset" error message
* include the encoding in "unsupported content encoding" error message
* deps: depd@~1.0.0

1.8.4 / 2014-09-23
Expand Down
3 changes: 2 additions & 1 deletion lib/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ function contentstream(req, inflate) {
stream.length = length
break
default:
err = new Error('unsupported content encoding')
err = new Error('unsupported content encoding "' + encoding + '"')
err.encoding = encoding
err.status = 415
throw err
}
Expand Down
2 changes: 1 addition & 1 deletion test/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ describe('bodyParser.json()', function(){
test.set('Content-Encoding', 'nulls')
test.set('Content-Type', 'application/json')
test.write(new Buffer('000000000000', 'hex'))
test.expect(415, 'unsupported content encoding', done)
test.expect(415, 'unsupported content encoding "nulls"', done)
})

it('should 400 on malformed encoding', function(done){
Expand Down
2 changes: 1 addition & 1 deletion test/raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ describe('bodyParser.raw()', function(){
test.set('Content-Encoding', 'nulls')
test.set('Content-Type', 'application/octet-stream')
test.write(new Buffer('000000000000', 'hex'))
test.expect(415, 'unsupported content encoding', done)
test.expect(415, 'unsupported content encoding "nulls"', done)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ describe('bodyParser.text()', function(){
test.set('Content-Encoding', 'nulls')
test.set('Content-Type', 'text/plain')
test.write(new Buffer('000000000000', 'hex'))
test.expect(415, 'unsupported content encoding', done)
test.expect(415, 'unsupported content encoding "nulls"', done)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ describe('bodyParser.urlencoded()', function(){
test.set('Content-Encoding', 'nulls')
test.set('Content-Type', 'application/x-www-form-urlencoded')
test.write(new Buffer('000000000000', 'hex'))
test.expect(415, 'unsupported content encoding', done)
test.expect(415, 'unsupported content encoding "nulls"', done)
})
})
})
Expand Down

0 comments on commit 360cf1b

Please sign in to comment.