fix(yar): add missing session id property (#27761)

This commit is contained in:
Simon Schick
2018-08-01 11:33:59 -07:00
committed by Sheetal Nandi
parent 794cbd6ada
commit 29d45249cd
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -105,12 +105,17 @@ declare namespace yar {
* an optional function to create custom session IDs.
* Must retun a string and have the signature function (request) where:
* request - (optional) is the original request received from the client.
* Defaults to uuidv4
*/
customSessionIDGenerator?(req: Request): string;
};
}
interface Yar {
/**
* Session id, see `customSessionIDGenerator`.
*/
readonly id: string;
/**
* clears the session and assigns a new session id.
*/
+4 -1
View File
@@ -18,7 +18,10 @@ async function boot() {
method: 'get',
handler(request: Request) {
const example = request.yar.get('example');
return example.key;
return {
id: request.yar.id,
key: example.key,
};
},
});
}