Skip to content

Commit

Permalink
Merge 20164ad into 704bfde
Browse files Browse the repository at this point in the history
  • Loading branch information
bminer committed Mar 21, 2016
2 parents 704bfde + 20164ad commit 47e8d01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -12,13 +12,13 @@ function inflate(stream, options) {

var encoding = options.encoding
|| (stream.headers && stream.headers['content-encoding'])
|| ''
|| 'identity'

switch (encoding) {
case 'gzip':
case 'deflate':
break
case '':
case 'identity':
return stream
default:
var err = new Error('Unsupported Content-Encoding: ' + encoding)
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "inflation",
"description": "Easily unzip an HTTP stream",
"version": "1.0.2",
"version": "1.1.0",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
"license": "MIT",
"repository": "stream-utils/inflation",
Expand Down
10 changes: 9 additions & 1 deletion test/test.js
Expand Up @@ -28,11 +28,19 @@ describe('inflate(stream, options)', function () {
assertBuffer(inflation(stream, opts), string, done)
})

it('should pass-through identity streams', function (done) {
var stream = createStream(new Buffer('identity!', 'utf-8'))
var string = 'identity!'
stream.headers = {}
assertBuffer(inflation(stream), string, done)
})

describe('stream with headers', function () {

it('should pass-through identity streams', function (done) {
var stream = createStream(new Buffer('identity!', 'utf-8'))
var string = 'identity!'
stream.headers = {}
stream.headers = {'content-encoding': 'identity'}
assertBuffer(inflation(stream), string, done)
})

Expand Down

0 comments on commit 47e8d01

Please sign in to comment.