Skip to content

Commit

Permalink
only unpipe on streams that have unpipe methods
Browse files Browse the repository at this point in the history
remove unpipe dependency

for some reason, using unpipe unconditionally caused tests to fail
on node 0.10.x. Only calling unpipe on streams that do have the
unpipe method makes all tests work across 0.10, 0.12 and 4.0 node
versions.
  • Loading branch information
gustav-olsen-groupone committed Sep 23, 2015
1 parent 9f13b9d commit ca15209
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/processImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ var Path = require('path'),
_ = require('underscore'),
httpErrors = require('httperrors'),
getFilterInfosAndTargetContentTypeFromQueryString = require('./getFilterInfosAndTargetContentTypeFromQueryString'),
mime = require('mime'),
unpipe = require('unpipe');
mime = require('mime');

var hijackResponse = require('hijackresponse');

Expand Down Expand Up @@ -68,7 +67,11 @@ module.exports = function (options) {
// next. doing the unpiping before calling next caused
// the tests to fail on node 0.12 (not on 4.0 and 0.10).
if (filters) {
filters.forEach(unpipe);
filters.forEach(function (filter) {
if (filter.unpipe) {
filter.unpipe()
}
});
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"passerror": "0.0.1",
"pngcrush": "0.2.0",
"pngquant": "0.6.0",
"underscore": "1.8.3",
"unpipe": "1.0.0"
"underscore": "1.8.3"
},
"optionalDependencies": {
"sharp": "0.11.2",
Expand Down

0 comments on commit ca15209

Please sign in to comment.