Skip to content

Commit

Permalink
Merge a9d7900 into 3b0335f
Browse files Browse the repository at this point in the history
  • Loading branch information
petermoresi committed Jun 15, 2016
2 parents 3b0335f + a9d7900 commit 8a67a64
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Readme.md
Expand Up @@ -107,6 +107,10 @@ app.use(convert(session(app)));

Set cookie's maxAge.

### Session#session=

`{session: true}` will set the cookie expiry to the browser session.

### Destroying a session

To destroy a session simply set it to `null`:
Expand Down
6 changes: 6 additions & 0 deletions index.js
Expand Up @@ -293,6 +293,12 @@ Session.prototype.save = function(){
debug('encode %j error: %s', json, e);
json = '';
}

// delete maxAge when user specifies cookie to expire with browser session
if (opts.session === true) {
delete opts.maxAge;
}

ctx.cookies.set(key, json, opts);
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "koa-session",
"description": "Koa cookie session middleware",
"repository": "koajs/session",
"version": "3.3.1",
"version": "3.3.2",
"keywords": [
"koa",
"middleware",
Expand Down

0 comments on commit 8a67a64

Please sign in to comment.