Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete http header content-md5 #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ module.exports = function staticCache(dir, options, files) {
ctx.type = file.type
ctx.length = file.zipBuffer ? file.zipBuffer.length : file.length
ctx.set('cache-control', file.cacheControl || 'public, max-age=' + file.maxAge)
if (file.md5) ctx.set('content-md5', file.md5)

if (ctx.method === 'HEAD')
return
Expand Down
3 changes: 1 addition & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,13 @@ describe('Static Cache', function () {
.expect(200, done)
})

it('should set the etag and content-md5 headers', function (done) {
it('should set the etag header', function (done) {
var pk = fs.readFileSync('package.json')
var md5 = crypto.createHash('md5').update(pk).digest('base64')

request(server)
.get('/package.json')
.expect('ETag', '"' + md5 + '"')
.expect('Content-MD5', md5)
.expect(200, done)
})

Expand Down