Skip to content

Commit

Permalink
Merge 5c32464 into 33b2fa4
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlambie committed Jan 30, 2019
2 parents 33b2fa4 + 5c32464 commit 43d268c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions dadi/lib/controller/index.js
Expand Up @@ -75,11 +75,6 @@ const Controller = function (router) {
}

let etagResult = etag(data)
let contentLength = Buffer.isBuffer(data)
? data.byteLength
: data.length

res.setHeader('Content-Length', contentLength)
res.setHeader('ETag', etagResult)

if (this.shouldCompress(req, handler)) {
Expand All @@ -89,9 +84,15 @@ const Controller = function (router) {
zlib.gzip(data, (err, compressedData) => {
if (err) return reject(err)

res.setHeader('Content-Length', compressedData.byteLength)
resolve(compressedData)
})
})
} else {
res.setHeader(
'Content-Length',
Buffer.isBuffer(data) ? data.byteLength : data.length
)
}

return Promise.resolve(data).then(data => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -25,7 +25,6 @@
"babel-preset-env": "1.6.1",
"babel-preset-minify": "0.5.0",
"body-parser": "^1.18.2",
"busboy": "^0.2.13",
"chokidar": "^2.0.3",
"cloudfront": "~0.4.0",
"color-namer": "^1.1.0",
Expand Down Expand Up @@ -92,7 +91,8 @@
"should": "~13.2.0",
"sinon": "^4.0.2",
"standard": "8.x.x",
"supertest": "~3.2.0"
"superagent": "^4.1.0",
"supertest": "^3.4.2"
},
"greenkeeper": {
"ignore": [
Expand Down
1 change: 0 additions & 1 deletion test/acceptance/visual.js
Expand Up @@ -58,7 +58,6 @@ function requestTestImage (test) {
return Jimp
.read(baselineImagePath)
.then(baselineImage => {
console.log('baselineImage :', baselineImage)
return Jimp
.read(cdnUrl + requestPath)
.then(testImage => {
Expand Down

0 comments on commit 43d268c

Please sign in to comment.