Skip to content

Commit

Permalink
fix: use yield instead of yield* (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and dead-horse committed Aug 21, 2017
1 parent 8899552 commit b2bd371
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,9 +1,8 @@
sudo: false
node_js:
- "5"
- "8"
- "6"
- "4"
- "3"
- "2"
- "0.12"
language: node_js
script: "npm run test-travis"
Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -23,11 +23,11 @@ module.exports = etag;

function etag(options) {
return function *etag(next){
yield* next;
yield next;

// no body
var body = this.body;
if (!body || this.response.get('ETag')) return;
if (!body || this.response.get('etag')) return;

// type
var status = this.status / 100 | 0;
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Expand Up @@ -54,7 +54,7 @@ describe('etag()', function(){

request(app.listen())
.get('/')
.expect('ETag', '"b-sQqNsWTgdUEFt6mb5y4/5Q"')
.expect('ETag', '"b-Ck1VqNd45QIvq3AZd8XYQLvEhtA"')
.end(done);
})
})
Expand All @@ -72,7 +72,7 @@ describe('etag()', function(){

request(app.listen())
.get('/')
.expect('ETag', '"b-sQqNsWTgdUEFt6mb5y4/5Q"')
.expect('ETag', '"b-Ck1VqNd45QIvq3AZd8XYQLvEhtA"')
.end(done);
})
})
Expand All @@ -90,7 +90,7 @@ describe('etag()', function(){

request(app.listen())
.get('/')
.expect('ETag', '"d-m7WPJhkuS6APAeLnsTa72A"')
.expect('ETag', '"d-pedE0BZFQNM7HX6mFsKPL6l+dUo"')
.end(done);
})
})
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('etag()', function(){

request(app.listen())
.get('/')
.expect('ETag', 'W/"b-sQqNsWTgdUEFt6mb5y4/5Q"')
.expect('ETag', 'W/"b-Ck1VqNd45QIvq3AZd8XYQLvEhtA"')
.end(done);
})
})
Expand Down

0 comments on commit b2bd371

Please sign in to comment.